Browse Source

Make GetReferenceAssemblyPath pick the closest available version.

pull/2585/head
Siegfried Pammer 4 years ago
parent
commit
518ade7523
  1. 6
      ICSharpCode.Decompiler/Metadata/DotNetCorePathFinder.cs

6
ICSharpCode.Decompiler/Metadata/DotNetCorePathFinder.cs

@ -175,7 +175,9 @@ namespace ICSharpCode.Decompiler.Metadata
default: default:
throw new NotSupportedException(); throw new NotSupportedException();
} }
return Path.Combine(dotnetBasePath, "packs", identifier + ".Ref", version.ToString(), "ref", identifierExt); string basePath = Path.Combine(dotnetBasePath, "packs", identifier + ".Ref");
string versionFolder = GetClosestVersionFolder(basePath, version);
return Path.Combine(basePath, versionFolder, "ref", identifierExt);
} }
static IEnumerable<DotNetCorePackageInfo> LoadPackageInfos(string depsJsonFileName, string targetFramework) static IEnumerable<DotNetCorePackageInfo> LoadPackageInfos(string depsJsonFileName, string targetFramework)
@ -244,7 +246,7 @@ namespace ICSharpCode.Decompiler.Metadata
var foundVersions = new DirectoryInfo(basePath).GetDirectories() var foundVersions = new DirectoryInfo(basePath).GetDirectories()
.Select(d => ConvertToVersion(d.Name)) .Select(d => ConvertToVersion(d.Name))
.Where(v => v.version != null); .Where(v => v.version != null);
foreach (var folder in foundVersions.OrderBy(v => v.Item1)) foreach (var folder in foundVersions.OrderBy(v => v.version))
{ {
if (folder.version >= version) if (folder.version >= version)
return folder.directoryName; return folder.directoryName;

Loading…
Cancel
Save