Skip to content

Commit

Permalink
Pass dotnet directory instead of file path during .NET SDK resolution (
Browse files Browse the repository at this point in the history
…#454)

Fixes #453
  • Loading branch information
jeffkl authored Feb 10, 2023
1 parent b19739d commit 085038d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Shared/DotNetCoreSdkResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ public static bool TryResolveDotNetCoreSdk(IEnvironmentProvider environmentProvi
Console.ForegroundColor = ConsoleColor.Red;
Console.BackgroundColor = ConsoleColor.Black;

ResolveSdk(environmentProvider, dotnetFileInfo.FullName);
ResolveSdk(environmentProvider, dotnetFileInfo.Directory);

Console.ResetColor();

return false;
}

private static (string sdkDirectory, string globalJsonPath) ResolveSdk(IEnvironmentProvider environmentProvider, string dotnetExeDirectory)
private static (string sdkDirectory, string globalJsonPath) ResolveSdk(IEnvironmentProvider environmentProvider, DirectoryInfo dotnetExeDirectory)
{
string sdkDirectory = null;
string globalJsonPath = null;
Expand All @@ -147,11 +147,11 @@ void HandleResolveSdkResult(int key, string value)

if (Utility.RunningOnWindows)
{
Windows.ResolveSdk(dotnetExeDirectory, environmentProvider.CurrentDirectory, 0 /* None */, HandleResolveSdkResult);
Windows.ResolveSdk(dotnetExeDirectory.FullName, environmentProvider.CurrentDirectory, 0 /* None */, HandleResolveSdkResult);
}
else
{
Unix.ResolveSdk(dotnetExeDirectory, environmentProvider.CurrentDirectory, 0 /* None */, HandleResolveSdkResult);
Unix.ResolveSdk(dotnetExeDirectory.FullName, environmentProvider.CurrentDirectory, 0 /* None */, HandleResolveSdkResult);
}

return (sdkDirectory, globalJsonPath);
Expand Down

0 comments on commit 085038d

Please sign in to comment.