C++ VS 2012 - 由于缺少工具集,项目无法构建

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20886391/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 23:22:37  来源:igfitidea点击:

VS 2012 - Project failed to build because of missing Toolset

c++visual-studiovisual-studio-2012msbuild

提问by Sad CRUD Developer

I am unable to compile/build anything within Visual Studio C++ 2012 because I am getting an error that states either I have an inappropriate ToolsVersion or that the ToolSet is missing.

我无法在 Visual Studio C++ 2012 中编译/构建任何内容,因为我收到一个错误,指出我的 ToolsVersion 不合适或缺少工具集。

Here is the error in the console:

这是控制台中的错误:

Project file contains ToolsVersion="12.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="4.0".

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v120 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v120 to build using the v120 build tools.

项目文件包含 ToolsVersion="12.0"。此工具集可能未知或丢失,在这种情况下,您可以通过安装适当版本的 MSBuild 来解决此问题,或者由于策略原因,构建可能已被强制使用特定的 ToolsVersion。将项目视为具有 ToolsVersion="4.0"。

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v120 (Platform Toolset = 'v120 ') 找不到。要使用 v120 构建工具进行构建,请单击“项目”菜单或右键单击解决方案,然后选择“更新 VC++ 项目...”。安装 v120 以使用 v120 构建工具进行构建

I have installed Microsoft SDK. This may be relevant also - I downgraded from 2013 VSRC to 2012 MSVC recently but I made a clean uninstallation.

我已经安装了 Microsoft SDK。这也可能是相关的 - 我最近从 2013 VSRC 降级到 2012 MSVC,但我做了一个干净的卸载。

回答by Jonathan

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

找不到 v120 的构建工具(平台工具集 = 'v120')

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

项目 -> 属性 -> 常规 -> 平台工具集(如 IInspectable 正确评论的那样)

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

项目文件包含 ToolsVersion="12.0" (...) 将项目视为具有 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
  1. 右键单击项目 -> 卸载项目
  2. 右键单击项目-> 编辑(名称).vcxproj
    • 改变这一行: <Project DefaultTargets="Build" ToolsVersion="12.0" ...
    • 进入: <Project DefaultTargets="Build" ToolsVersion="4.0" ...
  3. 保存,关闭,右键单击项目 -> 重新加载项目

回答by Tod Thomson

Try Microsoft Build Tools 2013 for building ToolsVersion="12.0" projects here:

在此处尝试使用 Microsoft Build Tools 2013 来构建 ToolsVersion="12.0" 项目:

http://www.microsoft.com/en-au/download/details.aspx?id=40760

http://www.microsoft.com/en-au/download/details.aspx?id=40760

It might help you get going.

它可能会帮助你开始。