msbuildvisual-c++-2013

Can platform toolset be specified on MSBuild command-line?


I have a C++ static library project and want to build it with both VC++ 2010 and VC++ 2013. Now I first set the platform toolset to v120 and build, then change it to v100 and build again. Is there any automation for this process especially by specifying the toolset on the MSBuild command line?


Solution

  • I've found the solution:

    msbuild.exe /t:Rebuild /p:Configuration=Debug /p:Platform=Win32 /p:PlatformToolset=v120 foo.sln
    

    This could be automated using PowerShell or simply in a batch file:

    for %%t in (v100 v120) do (
        msbuild.exe /t:Rebuild /p:Configuration=Debug /p:Platform=Win32 /p:PlatformToolset=%%t foo.sln
    )
    

    Also other properties like Configuration and Platform could be changed via msbuild.exe command-line. That's great!