C++ MSbuild 错误:找不到 v140(平台工具集 = 'v140')的构建工具
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33154696/
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
MSbuild Error: The builds tools for v140 (Platform Toolset = 'v140') cannot be found
提问by Arash
I have a solution which is consists of a large number of projects (C++ and C#). I upgraded the solution to VS2015, so the toolset version for most of them are now set to V140, but a small number of projects need to remain in V110 (third party libraries, etc). When I build the solution in Visual Studio 2015, it builds just fine, but when TeamFoundationServer tries to build it, it fails with the following error:
我有一个由大量项目(C++ 和 C#)组成的解决方案。我把方案升级到了VS2015,所以现在大部分的工具集版本都设置为V140,但少部分项目需要保留在V110(第三方库等)。当我在 Visual Studio 2015 中构建解决方案时,它构建得很好,但是当 TeamFoundationServer 尝试构建它时,它失败并显示以下错误:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets (44): The builds tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v140 to build using the v140 build tools.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets (44):找不到 v140 的构建工具(平台工具集 = 'v140')。要使用 v140 构建工具进行构建,请单击“项目”菜单或右键单击解决方案,然后选择“更新 VC++ 项目...”。安装 v140 以使用 v140 构建工具进行构建。
I tried to specify the VisualStudioVersion or the path to the right MSBuild version as build arguments, but it didn't work as the rest of the projects (the ones in V110) will be in trouble.
我尝试将 VisualStudioVersion 或正确 MSBuild 版本的路径指定为构建参数,但它不起作用,因为其余项目(V110 中的项目)会遇到麻烦。
Any help would be very appreciated.
任何帮助将不胜感激。
回答by Jacob Nelson
I had the same issue. Steps given in this Solutionhelped me solve my issue. Repeating the steps here for future reference.
我遇到过同样的问题。此解决方案中给出的步骤帮助我解决了我的问题。重复此处的步骤以供将来参考。
If you're attempting to build a Win32 "Desktop" application, the easiest way to get the v140 Platform Toolset is via the Visual Studio Installer (please see the image, below, for an illustration of steps '3.' and '4.'):
如果您正在尝试构建 Win32“桌面”应用程序,获取 v140 平台工具集的最简单方法是通过 Visual Studio 安装程序(请参见下图,了解步骤“3”和“4”的说明。 '):
- Launch the "Visual Studio Installer" from your start menu.
- Select "Modify" for the instance of Visual Studio 2017 you have installed.
- Under the "Summary" pane of the workload selector, click the "Desktop development with C++" expander (if it is collapsed)
- Check the "VC++ 2015.3 v140 toolset (x86,x64)" optional feature.
- 从开始菜单启动“Visual Studio 安装程序”。
- 为已安装的 Visual Studio 2017 实例选择“修改”。
- 在工作负载选择器的“摘要”窗格下,单击“使用 C++ 进行桌面开发”扩展器(如果它已折叠)
- 检查“VC++ 2015.3 v140 工具集(x86,x64)”可选功能。
回答by PatrickLu-MSFT
The builds tools for v140 that's the platform toolset for VS2015.
v140 的构建工具是 VS2015 的平台工具集。
If you are using TFS2015, you must make sure the build environment on your build machine be the same as your local developer machine. You should install VS2015 on your build machine.
如果您使用的是 TFS2015,您必须确保您的构建机器上的构建环境与您本地的开发者机器相同。您应该在构建机器上安装 VS2015。
If you are using TFS2013 or TFS2012, most probably MSBuild 12.0 is called.You need to set the build templates to point to MS Build version 14.0. For the details, check: TFS 2013 building .NET 4.6 / C# 6.0
如果您使用的是 TFS2013 或 TFS2012,则很可能调用的是 MSBuild 12.0。您需要将构建模板设置为指向 MS Build 14.0 版。有关详细信息,请查看:TFS 2013 building .NET 4.6 / C# 6.0
回答by h-rai
Jacob's answerworked for me but C++ build tools were under VS Build Tools 2017 while I had VS 2019 Installer on Windows 10 as at July, 2019.
Jacob 的回答对我有用,但 C++ 构建工具在 VS Build Tools 2017 下,而截至 2019 年 7 月,我在 Windows 10 上安装了 VS 2019 安装程序。
回答by Algorithmic
You're trying to build using a different version of the build toolset that is either not installed on your system or that the project can't use. To change it to something that you have installed on your system, right click on the project in your Solution Explorer.
您正在尝试使用不同版本的构建工具集进行构建,该版本未安装在您的系统上或项目无法使用。要将其更改为系统上已安装的内容,请右键单击解决方案资源管理器中的项目。
Go to Properties. Configuration Properties>General>Platform Toolset>(Change this to a toolset that is installed on your system). Make sure you do this for the Debug and Release builds
转到属性。配置属性>常规>平台工具集>(将此更改为系统上安装的工具集)。确保为 Debug 和 Release 构建执行此操作
回答by Aisha G
This solution worked perfectly for me: https://social.msdn.microsoft.com/Forums/vstudio/en-US/e0b9c601-2ece-4dcc-bac3-23ed7dd6801a/the-builds-tools-for-v120-platform-toolset-v120-cannot-be-found?forum=vclanguage
这个解决方案非常适合我:https: //social.msdn.microsoft.com/Forums/vstudio/en-US/e0b9c601-2ece-4dcc-bac3-23ed7dd6801a/the-builds-tools-for-v120-platform-toolset -v120-cannot-be-found?forum=vclanguage