Skip to content

Commit

Permalink
fix(hr): Ensure that the msbuild version used is properly aligned
Browse files Browse the repository at this point in the history
Ensures that the MSBuild version is determined using the appropriate folder, where `dotnet --version` used the latest available SDK on the machine. With this change, the MSBuild version will be the one explicitly used by the app. Combined with unoplatform#14170, the devserver now completely uses the appropriate SDK/runtime version based on the app's compilation.
  • Loading branch information
jeromelaban committed Oct 30, 2023
1 parent 5304e0e commit 2312c2e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static void InitializeRoslyn(string? workDir)
{
RegisterAssemblyLoader();

MSBuildBasePath = BuildMSBuildPath();
MSBuildBasePath = BuildMSBuildPath(workDir);

var version = GetDotnetVersion(workDir);
if (version.Major != typeof(object).Assembly.GetName().Version?.Major)
Expand Down Expand Up @@ -135,9 +135,9 @@ private static Version GetDotnetVersion(string? workDir)
throw new InvalidOperationException("Failed to read dotnet version");
}

private static string BuildMSBuildPath()
private static string BuildMSBuildPath(string? workDir)
{
var result = ProcessHelper.RunProcess("dotnet.exe", "--info");
var result = ProcessHelper.RunProcess("dotnet.exe", "--info", workDir);

if (result.exitCode == 0)
{
Expand Down

0 comments on commit 2312c2e

Please sign in to comment.