fix framework assembly resolution for net35 (#2557)
This commit is contained in:
parent
e8eaebdaeb
commit
7c688eea7f
3 changed files with 33 additions and 11 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
namespace ConsoleApplication
|
namespace ConsoleApplication
|
||||||
{
|
{
|
||||||
|
@ -7,6 +8,10 @@ namespace ConsoleApplication
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Hello World!");
|
Console.WriteLine("Hello World!");
|
||||||
|
#if NET20 || NET35 || NET45 || NET461
|
||||||
|
// Force XmlDocument to be used
|
||||||
|
var doc = new XmlDocument();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,28 @@
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net20": {},
|
"net20": {
|
||||||
"net35": {},
|
"frameworkAssemblies": {
|
||||||
"net40": {},
|
"System.Xml": {}
|
||||||
"net461": {},
|
}
|
||||||
|
},
|
||||||
|
"net35": {
|
||||||
|
"frameworkAssemblies": {
|
||||||
|
"System.Xml": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"net40": {
|
||||||
|
"frameworkAssemblies": {
|
||||||
|
"System.Xml": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"net461": {
|
||||||
|
"frameworkAssemblies": {
|
||||||
|
"System.Xml": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
"netstandard1.5": {
|
"netstandard1.5": {
|
||||||
|
"imports": "dnxcore50",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"NETStandard.Library": "1.5.0-rc2-24018"
|
"NETStandard.Library": "1.5.0-rc2-24018"
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||||
private static readonly NuGetFramework Dnx46 = new NuGetFramework(
|
private static readonly NuGetFramework Dnx46 = new NuGetFramework(
|
||||||
FrameworkConstants.FrameworkIdentifiers.Dnx,
|
FrameworkConstants.FrameworkIdentifiers.Dnx,
|
||||||
new Version(4, 6));
|
new Version(4, 6));
|
||||||
|
|
||||||
private static FrameworkReferenceResolver _default;
|
private static FrameworkReferenceResolver _default;
|
||||||
|
|
||||||
private readonly IDictionary<NuGetFramework, FrameworkInformation> _cache = new Dictionary<NuGetFramework, FrameworkInformation>();
|
private readonly IDictionary<NuGetFramework, FrameworkInformation> _cache = new Dictionary<NuGetFramework, FrameworkInformation>();
|
||||||
|
@ -30,14 +30,14 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||||
{ FrameworkConstants.CommonFrameworks.Dnx451, new [] { FrameworkConstants.CommonFrameworks.Net451 } },
|
{ FrameworkConstants.CommonFrameworks.Dnx451, new [] { FrameworkConstants.CommonFrameworks.Net451 } },
|
||||||
{ Dnx46, new [] { FrameworkConstants.CommonFrameworks.Net46 } }
|
{ Dnx46, new [] { FrameworkConstants.CommonFrameworks.Net46 } }
|
||||||
};
|
};
|
||||||
|
|
||||||
public FrameworkReferenceResolver(string referenceAssembliesPath)
|
public FrameworkReferenceResolver(string referenceAssembliesPath)
|
||||||
{
|
{
|
||||||
ReferenceAssembliesPath = referenceAssembliesPath;
|
ReferenceAssembliesPath = referenceAssembliesPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReferenceAssembliesPath { get; }
|
public string ReferenceAssembliesPath { get; }
|
||||||
|
|
||||||
public static FrameworkReferenceResolver Default
|
public static FrameworkReferenceResolver Default
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -46,11 +46,11 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||||
{
|
{
|
||||||
_default = new FrameworkReferenceResolver(GetDefaultReferenceAssembliesPath());
|
_default = new FrameworkReferenceResolver(GetDefaultReferenceAssembliesPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
return _default;
|
return _default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetDefaultReferenceAssembliesPath()
|
public static string GetDefaultReferenceAssembliesPath()
|
||||||
{
|
{
|
||||||
// Allow setting the reference assemblies path via an environment variable
|
// Allow setting the reference assemblies path via an environment variable
|
||||||
|
@ -210,7 +210,7 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||||
// Check for legacy frameworks
|
// Check for legacy frameworks
|
||||||
if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows &&
|
if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows &&
|
||||||
targetFramework.IsDesktop() &&
|
targetFramework.IsDesktop() &&
|
||||||
targetFramework.Version <= new Version(3, 5))
|
targetFramework.Version <= new Version(3, 5, 0, 0))
|
||||||
{
|
{
|
||||||
return GetLegacyFrameworkInformation(targetFramework, referenceAssembliesPath);
|
return GetLegacyFrameworkInformation(targetFramework, referenceAssembliesPath);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue