diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-08-29 14:30:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-29 14:30:32 +0200 |
commit | f10c3810bb0abfa18b1a579ee927f460bf191b6d (patch) | |
tree | 70357d79e08f7cc5879732dce8c79945080b2edc /modules/mono | |
parent | 6ae83b64ef29c9eaf853d0ed0e7dafca8e7ea580 (diff) | |
parent | 5dc390072757c58af4725a84862eb83480c57d7a (diff) |
Merge pull request #41375 from Thaina/patch-1
Mono: Improve MSBuildFinder logic on Windows
Diffstat (limited to 'modules/mono')
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs index f36e581a5f..7bfba779fb 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs @@ -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"}; |