Skip to content

Commit

Permalink
Merge pull request #41375 from Thaina/patch-1
Browse files Browse the repository at this point in the history
Mono: Improve MSBuildFinder logic on Windows
  • Loading branch information
akien-mga authored Aug 29, 2020
2 parents 6ae83b6 + 5dc3900 commit f10c381
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,21 @@ private static string FindMsBuildToolsPathOnWindows()

// Try to find 15.0 with vswhere

string vsWherePath = Environment.GetEnvironmentVariable(Internal.GodotIs32Bits() ? "ProgramFiles" : "ProgramFiles(x86)");
vsWherePath += "\\Microsoft Visual Studio\\Installer\\vswhere.exe";
var envNames = Internal.GodotIs32Bits() ? new[] { "ProgramFiles", "ProgramW6432" } : new[] { "ProgramFiles(x86)", "ProgramFiles" };

string vsWherePath = null;
foreach (var envName in envNames)
{
vsWherePath = Environment.GetEnvironmentVariable(envName);
if (!string.IsNullOrEmpty(vsWherePath))
{
vsWherePath += "\\Microsoft Visual Studio\\Installer\\vswhere.exe";
if (File.Exists(vsWherePath))
break;
}

vsWherePath = null;
}

var vsWhereArgs = new[] {"-latest", "-products", "*", "-requires", "Microsoft.Component.MSBuild"};

Expand Down

0 comments on commit f10c381

Please sign in to comment.