Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 - command line retarget solution

Tags:

Trying to build an older project (VS2010) with Visual Studio 2015 - from the command line. But, I'm getting this:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(55,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 "Retarget solution".

Anyone know how to "Retarget solution" from the command line?

like image 731
Kit Plummer Avatar asked Oct 27 '15 23:10

Kit Plummer


People also ask

What is Platform Toolset in Visual Studio?

The platform toolset consists of the C++ compiler (cl.exe) and linker (link.exe), along with the C/C++ standard libraries. Visual Studio 2015, Visual Studio 2017, and Visual Studio 2019 are binary-compatible. It's shown by the major version of the toolset, which has remained at 14.


1 Answers

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(55,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found.

Clearly, you don't have Visual Studio 2010 (Platform Toolset = 'v100') toolset installed and your old project (Visual Studio 2010) refers to it.

Your options:

  1. If you open a vcxproj file in Visual Studio 2015, Go to project properties -> General settings. you'll see that there is a PlatformToolset property. For Visual Studio 2015, it is v140; For Visual Studio 2010, it is v100.

    Change the Platform Toolset to Visual Studio 2015 (Platform Toolset = 'v140'). You may then be able to build from command line and from VS editor as well (beware, upgrading solution doesn't not guarantee that solution will build fine.)

  2. You can set PlatformToolset without changing vcxproj file. You could overwrite PlatformToolset property with /p:PlatformToolset=v140 to change the toolset.

    e.g. msbuild myProject.vcxproj /p:PlatformToolset=v140

In case you don't know Platform Toolset and their values:

Visual Studio .NET 2002 (Platform Toolset = 'v70') Visual Studio .NET 2003 (Platform Toolset = 'v71') Visual Studio 2005      (Platform Toolset = 'v80') Visual Studio 2008      (Platform Toolset = 'v90') Visual Studio 2010      (Platform Toolset = 'v100') Visual Studio 2012      (Platform Toolset = 'v110') Visual Studio 2013      (Platform Toolset = 'v120') Visual Studio 2015      (Platform Toolset = 'v140') Visual Studio 2017      (Platform Toolset = 'v141') Visual Studio 2019      (Platform Toolset = 'v142') ... 
like image 155
user1 Avatar answered Oct 12 '22 14:10

user1