Browse Source

Resolve framework assemblies from more .NET Core runtime packs, like "Microsoft.WindowsDesktop.App" etc.

pull/1728/head
Andreas Weizel 6 years ago
parent
commit
c12b5d60ec
  1. 14
      ICSharpCode.Decompiler/Metadata/DotNetCorePathFinder.cs

14
ICSharpCode.Decompiler/Metadata/DotNetCorePathFinder.cs

@ -53,6 +53,13 @@ namespace ICSharpCode.Decompiler.Metadata @@ -53,6 +53,13 @@ namespace ICSharpCode.Decompiler.Metadata
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".nuget", "packages")
};
static readonly string[] RuntimePacks = new[] {
"Microsoft.NETCore.App",
"Microsoft.WindowsDesktop.App",
"Microsoft.AspNetCore.App",
"Microsoft.AspNetCore.All"
};
readonly Dictionary<string, DotNetCorePackageInfo> packages;
ISet<string> packageBasePaths = new HashSet<string>(StringComparer.Ordinal);
readonly string assemblyName;
@ -124,14 +131,17 @@ namespace ICSharpCode.Decompiler.Metadata @@ -124,14 +131,17 @@ namespace ICSharpCode.Decompiler.Metadata
string FallbackToDotNetSharedDirectory(IAssemblyReference name, Version version)
{
if (dotnetBasePath == null) return null;
var basePath = Path.Combine(dotnetBasePath, "shared", "Microsoft.NETCore.App");
if (dotnetBasePath == null)
return null;
var basePaths = RuntimePacks.Select(pack => Path.Combine(dotnetBasePath, "shared", pack));
foreach (var basePath in basePaths) {
var closestVersion = GetClosestVersionFolder(basePath, version);
if (File.Exists(Path.Combine(basePath, closestVersion, name.Name + ".dll"))) {
return Path.Combine(basePath, closestVersion, name.Name + ".dll");
} else if (File.Exists(Path.Combine(basePath, closestVersion, name.Name + ".exe"))) {
return Path.Combine(basePath, closestVersion, name.Name + ".exe");
}
}
return null;
}

Loading…
Cancel
Save