0
votes

I'm building many Visual Studio projects (.sln solutions files) from command-line with:

call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"

for /r %%X in (/*.sln) do (
msbuild %%X /p:configuration=release /p:platform=win32 /nologo /noconsolelogger /fileLogger /v:quiet /flp:logfile=build_errors.log;errorsonly;append

)

Unfortunately, they all have been created with MSVS2010. Thus I get errors:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgrade Solution...".

As I have 20 or 30 .sln files, I don't want to open each one and Upgrade solution, etc. (which I even didn't find exactly as mentioned here!).

Is there a command-line solution to upgrade all of them to MSVS2013 ?

2

2 Answers

1
votes

You can upgrade solution and all of its project files through devenv /upgrade command. (devenv.exe is in the VS installation path (..\Common7\IDE).

devenv SolutionFile | ProjectFile /upgrade

To build solution/project without upgrade, you can specify Toolset argument (/tv).

msbuild %%X /p:configuration=release /p:platform=win32 /tv:12.0
0
votes

If this is the only problem you can retarget the projects to use the VS2013 toolset instead of the one in VS2010. You can write a simple script in a language of your choice (or even do it manually) that iterates over all of your project files and replaces the value of PlatformToolset property to the <PlatformToolset>Visual Studio 2013 (v120)</PlatformToolset>. Alternatively, you can download and install the VS2010 build tools from the SDK - https://www.microsoft.com/en-us/download/details.aspx?id=8279