When I'm building a VS2010 with msbuild from the command line, can I change the platform toolset to v90 (i.e. Visual Studio 2008 toolchain) from the command line, without editing the vcxproj file?
I'm using the following command line in my build script currently:
mysystemf("msbuild %s.vcxproj /t:rebuild /p:configuration=release,platform=%s", prjname, platform);
To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.
To change the platform toolsetIn the properties page, select Platform Toolset and then select the toolset you want from the drop-down list. For example, if you've installed the Visual Studio 2010 toolset, select Visual Studio 2010 (v100) to use it for your project. Choose the OK button to save your changes.
By invoking msbuild.exe on your project or solution file, you can orchestrate and build products in environments where Visual Studio isn't installed. Visual Studio uses MSBuild to load and build managed projects.
Yes you can set PlatformToolset without change the vcxproj file.
If you open a vcxproj file, you'll see that there is a PlatformToolset
property.
For visual studio 2012, it is v110; For VS2010, it is v100; For VS2008, it is v90.
You could overwrite this property with /p:PlatformToolset=v110/v100/v90
to change the toolchain.
Note: Sometimes, msbuild failed with error Unsupported platformtoolset value
, it is mostly because you have not specify the VisualStudioVersion
.
I found the answer in MSDN:
To rebuild your project with the Visual C++ 9.0 toolset, type either of the following commands:
msbuild myproject.vcxproj /p:PlatformToolset=v90 /t:rebuild
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With