Browse Source

Fix #1720: Support new path structure of reference assemblies with .NET Core 3.0

pull/1728/head
Andreas Weizel 6 years ago
parent
commit
82524f391e
  1. 7
      ILSpy.AddIn/AssemblyFileFinder.cs

7
ILSpy.AddIn/AssemblyFileFinder.cs

@ -38,7 +38,7 @@ namespace ICSharpCode.ILSpy.AddIn @@ -38,7 +38,7 @@ namespace ICSharpCode.ILSpy.AddIn
static readonly string DetectTargetFrameworkIdRefPathPattern =
@"(Reference Assemblies[/\\]Microsoft[/\\]Framework[/\\](?<1>.NETFramework)[/\\]v(?<2>[^/\\]+)[/\\])" +
@"|(NuGetFallbackFolder[/\\](?<1>[^/\\]+)\\(?<2>[^/\\]+)([/\\].*)?[/\\]ref[/\\])";
@"|((NuGetFallbackFolder|packs)[/\\](?<1>[^/\\]+)\\(?<2>[^/\\]+)([/\\].*)?[/\\]ref[/\\])";
public static string DetectTargetFrameworkId(AssemblyDefinition assembly, string assemblyPath = null)
{
@ -63,6 +63,7 @@ namespace ICSharpCode.ILSpy.AddIn @@ -63,6 +63,7 @@ namespace ICSharpCode.ILSpy.AddIn
*
* - .NETFramework -> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll
* - .NETCore -> C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.1.0\ref\netcoreapp2.1\System.Console.dll
* -> C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0\ref\netcoreapp3.0\System.Runtime.Extensions.dll
* - .NETStandard -> C:\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.3\build\netstandard2.0\ref\netstandard.dll
*/
var pathMatch = Regex.Match(assemblyPath, DetectTargetFrameworkIdRefPathPattern,
@ -73,9 +74,9 @@ namespace ICSharpCode.ILSpy.AddIn @@ -73,9 +74,9 @@ namespace ICSharpCode.ILSpy.AddIn
if (type == ".NETFramework") {
return $".NETFramework,Version=v{version}";
} else if (type.Contains("netcore")) {
} else if (type.ToLower().Contains("netcore")) {
return $".NETCoreApp,Version=v{version}";
} else if (type.Contains("netstandard")) {
} else if (type.ToLower().Contains("netstandard")) {
return $".NETStandard,Version=v{version}";
}
}

Loading…
Cancel
Save