Reputation: 13713
I'm trying to build a Visual Studio 2019 solution from command line (though a PowerShell script), I need to have 2 builds - one for 64-bit and one for 32-bit though the script.
From Configuration Manager I have added x86 and x64 platforms to the Platform:
And in the project properties I have set up the Platform target accordingly:
I'm using the following command lines to build with MSBuild:
& $msbuildPath ../MyApp.Desktop.sln -t:Rebuild -p:Configuration=Release /p:Platform=x86
& $msbuildPath ../MyApp.Desktop.sln -t:Rebuild -p:Configuration=Release /p:Platform=x64
But it seems to ignore the /p:Platform
because it does not matter if I state x86
or x64
it always builds the "Active" platform set in Configuration Manager. But, if I put in platform an invalid value (for instance x123) the build would fail because that does not exist.
How can I make MSBuild actually build with the stated /p:Platform
?
Upvotes: 0
Views: 1075
Reputation: 23780
If you build your sln file, you should change the solution platform rather than the project platform.
Please try the following steps:
1) first, delete every project platform and do a clean for your project.And only retain the platform Any CPU
.
2) add the new x64
and x86
platform for the solution platform
3) close VS Instance, delete the bin
and obj
folder of every project
then run your powershell with /p:Platform=x64 or x86
. And it works well in my side. And it can return x86
or x64
output files without any problems.
Upvotes: 1