VS 2012 - Project Failed to Build Because of Missing Toolset

VS 2012 - Project failed to build because of missing Toolset

The builds tools for v120 (Platform Toolset = 'v120') cannot be found

Project -> Properties -> General -> Platform Toolset (as IInspectable correctly commented)

Project file contains ToolsVersion="12.0" (...) Treating the project
as if it had ToolsVersion="4.0"

  1. Right-click project -> Unload Project
  2. Right-click project -> Edit (name).vcxproj
    • Change this line: <Project DefaultTargets="Build" ToolsVersion="12.0" ...
    • into: <Project DefaultTargets="Build" ToolsVersion="4.0" ...
  3. Save, close, Right-click project -> Reload Project

Updating ToolsVersion=12.0 in Visual Studio 2012

It seems that you are trying to compile a Visual Studio 2013 Project (as it uses ToolsVersion=12.0) on Visual Studio 2012 (uses ToolsVersion=11.0).

So here is the solution to Your problem. #TestedSuccessfully

  1. In your Project Folder open the .Vcxproj file and change
    ToolsVersion=12.0 with 11.0

  2. You have to change 12.0 with 11.0 at 3 places hopefully. You can
    check for all occurences and You are done.

It worked for me. I hope will also work for You :)

I created a new project in VS 2019 and it doesn't compile because VS fails to find Toolset v142

To prove your issue, I have made a small test:

1) create a new system environment variable called VCTargetsPath and then set its value to

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\

Sample Image

2) then restart VS and also set the the Platfrom Toolset to v142under Project Properties.

Sample Image

3) then rebuild the project and get the same error:

Sample Image

Since you new created project has also the error, so I think you have do some changes to system environment variable.

Also, you should note that this path is for old VS2015.

However, VS2019 uses:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Platforms\Win32\PlatformToolsets\v142

You make a change so that it will overwrite the system value for VS2019 which leads to the issue. The value is global and affects all the vs versions on your current PC.

Suggestion

1) You should check your system environment variable and search for VCTargetsPath, if you has this variable, please delete it.

2) or if you have this variable VCTargetsPath, change its value to, or if you do not have it, create it and set its value to VS2019.

Sample Image

Visual Studio wants to build with wrong platform toolset

Under "C/C++", there was a lib in "Additional include directories". I did not use this lib, but it was referenced. I removed this lib.

I also deleted all "studio 2010" entries in the registry.

Building few projects fail with MSBuild

Solution 1) By creating one System Environment variable - VCTargetsPath with value - C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140, solved building the projects using command prompt on the build server.

But the above solution is not working when trying to build using Jenkins. The below solution resolved the issue.

Solution 2) Changed the build scripts to pass this parameter - /p:VCTargetsPath="C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V140"



Related Topics



Leave a reply



Submit