Skip to content

Commit

Permalink
Fix bug with file name + extension concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
YuliiaKovalova committed Aug 25, 2023
1 parent 6fabd1b commit 6c38067
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/MSBuildLocator/DotNetSdkLocationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private static void ModifyUnmanagedDllResolver(Action<AssemblyLoadContext> resol
private static IntPtr HostFxrResolver(Assembly assembly, string libraryName)
{
var hostFxrLibName = "libhostfxr";
var libExtention = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "dylib" : "so";
var libExtension = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "dylib" : "so";

if (!hostFxrLibName.Equals(libraryName))
{
Expand All @@ -147,10 +147,10 @@ private static IntPtr HostFxrResolver(Assembly assembly, string libraryName)

if (hostFxrAssemblyDirectory != null && !string.IsNullOrEmpty(hostFxrAssemblyDirectory.OriginalValue))
{
var hostfxrAssembly = Path.Combine(hostFxrAssemblyDirectory.OriginalValue, Path.ChangeExtension(hostFxrLibName, libExtension));
var hostFxrAssembly = Path.Combine(hostFxrAssemblyDirectory.OriginalValue, Path.ChangeExtension(hostFxrLibName, libExtension));
if (File.Exists(hostFxrAssembly))
{
return NativeLibrary.TryLoad(hostfxrAssembly, out var handle) ? handle : IntPtr.Zero;
return NativeLibrary.TryLoad(hostFxrAssembly, out var handle) ? handle : IntPtr.Zero;
}
}
}
Expand Down

0 comments on commit 6c38067

Please sign in to comment.