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"
- Right-click project -> Unload Project
- Right-click project -> Edit (name).vcxproj
- Change this line:
<Project DefaultTargets="Build" ToolsVersion="12.0" ...
- into:
<Project DefaultTargets="Build" ToolsVersion="4.0" ...
- Change this line:
- 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
In your Project Folder open the .Vcxproj file and change
ToolsVersion=12.0 with 11.0You 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\
2) then restart VS and also set the the Platfrom Toolset to v142
under Project Properties.
3) then rebuild the project and get the same error:
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.
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
How to Install Tensorflow on Windows
How to Find the Qt5 Cmake Module on Windows
Command Line Compile Using Cl.Exe
Google Protocol Buffers on iOS
Does Scopeguard Use Really Lead to Better Code
How to Pan Images in Qgraphicsview
Matching an Overloaded Function to Its Polymorphic Argument
Which Header Should I Include for 'Size_T'
How to Store a Lambda Expression as a Field of a Class in C++11
Virtual Destructor: Is It Required When Not Dynamically Allocated Memory
What Is the Type Signature of a C++11/1Y Lambda Function
How to Use Clang++ with -Std=C++11 -Weverything -Werror
How to Write an Adl-Enabled Trailing Return Type, or Noexcept Specification
C++11 Constexpr Flatten List of Std::Array into Array
Memset for Initialization in C++