Commit 93c71879 authored by Brad King's avatar Brad King
Browse files

VS: Use 64-bit MSBuild in VS 2022

Visual Studio 17 2022 is now a 64-bit native application.  It places the
64-bit `MSBuild.exe` in the `PATH` of VS command prompts, so prefer it
for this version and above.

This was previously attempted for older VS versions, but reverted by
commit f3cedf38 (VS: Revert "Use MSBuild matching toolset host
architecture", 2019-03-12, v3.14.0~1^2).  For now, do not use the 64-bit
MSBuild for VS 16 and below.

Fixes: #18219
parent c46b2658
Pipeline #234890 waiting for manual action with stages
in 12 minutes and 31 seconds
......@@ -716,6 +716,12 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand()
// Ask Visual Studio Installer tool.
std::string vs;
if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) {
if (this->Version >= cmGlobalVisualStudioGenerator::VS17) {
msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe";
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
}
msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe";
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment