Merge pull request #41375 from Thaina/patch-1

Mono: Improve MSBuildFinder logic on Windows
This commit is contained in:
Rémi Verschelde 2020-08-29 14:30:32 +02:00 committed by GitHub
commit f10c3810bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -161,8 +161,21 @@ namespace GodotTools.Build
// 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"};