Skip to content

Commit

Permalink
Fix hostfxr version directory parsing (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongin authored Apr 19, 2024
1 parent 389703c commit 84c93fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NodeApi/DotNetHost/HostFxr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private static string GetHostFxrPath(Version targetVersion, bool allowPrerelease
// Scan available hostfxr versions and find the best match to the target version.
for (int i = 0; i < versionDirs.Length; i++)
{
string versionString = versionDirs[i];
string versionString = Path.GetFileName(versionDirs[i]);
if (allowPrerelease)
{
int hyphenIndex = versionString.IndexOf('-');
Expand All @@ -85,7 +85,7 @@ private static string GetHostFxrPath(Version targetVersion, bool allowPrerelease
}
}

if (!Version.TryParse(Path.GetFileName(versionString), out Version? version))
if (!Version.TryParse(versionString, out Version? version))
{
// Skip prerelease versions when not allowed (or other unexpected subdir format).
continue;
Expand Down

0 comments on commit 84c93fc

Please sign in to comment.