使用MSBuild构建很少的项目会失败 [英] Building few projects fail with MSBuild

查看:79
本文介绍了使用MSBuild构建很少的项目会失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有其他C#项目文件都使用MSBuild脚本构建. 但是,很少有C ++相关项目因以下错误而失败-

All other C# project files are building with MSBuild scripts. But, few C++ related projects are failing with the below error -

C:\ Program Files(x86)\ MSBuild \ Microsoft.Cpp \ v4.0 \ V110 \ Microsoft.Cpp.Platform.targets(44,5):错误MSB8020:v140的构建工具(Platform Toolset =' v140') 找不到.要使用v140构建工具进行构建,请点击 在项目菜单或右键单击解决方案,然后选择更新VC ++ 项目...".安装v140以使用v140构建工具进行构建.

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: 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.

当我尝试使用命令提示符构建项目时出现上述错误,而尝试使用Jenkins进行构建时也出现了相同的错误.我们应该如何解决这个问题?

I am getting the above error when I try to build the project using command prompt and the same error is getting when trying to build using Jenkins. How should we fix this issue?

推荐答案

解决方案1)通过创建一个具有值-C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140的系统环境变量-VCTargetsPath,解决了在构建服务器上使用命令提示符构建项目的问题.

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.

但是,当尝试使用Jenkins进行构建时,上述解决方案不起作用.以下解决方案解决了该问题.

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

解决方案2)更改了构建脚本以传递此参数-/p:VCTargetsPath ="C:\ Program Files \ MSBuild \ Microsoft.Cpp \ v4.0 \ V140"

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

这篇关于使用MSBuild构建很少的项目会失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆