【发布时间】:2018-11-02 23:27:35
【问题描述】:
我正在构建一个新的 TFS 构建服务器,并决定使用 VS 2017 构建工具而不是安装 VS 的完整版本。当我尝试构建我们的 C++ 项目时,它会抛出以下错误:
Error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found.
经过数小时的研究,我离解决这个问题还差得远。我尝试添加以下注册表设置,但没有帮助。
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0]
"VCTargetsPath"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V140\'))"
"VCTargetsPath11"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath11)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V110\'))"
"VCTargetsPath14"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath14)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V140\'))"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0\11.0]
"VCTargetsPath"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V110\'))"
"VCTargetsPath11"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath11)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V110\'))"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0\14.0]
"VCTargetsPath"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V140\'))"
"VCTargetsPath11"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath11)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V110\'))"
"VCTargetsPath14"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath14)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V140\'))"
我猜这个产品的微软安装程序坏了。是否有针对此错误的标准修复程序,或者我应该放弃我的努力并简单地安装完整版本?
在项目文件中,我找到了这个条目:
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
所以,我猜这意味着变量 VSTargetsPath 以某种方式指向 D: 驱动器的根目录,但我不知道该值的设置位置。我们当前的构建服务器没有名为 VSTargetsPath 的环境变量集,但它确实缺少注册表项。它还安装了完整版的 VS。
【问题讨论】:
-
“我猜微软的安装程序在这个产品上是坏的”——不是一般的。我成功使用了。
-
我已经尝试卸载/重新安装和修复。不用找了。我错过了安装一个重要功能吗?
-
不知道。它对我来说开箱即用。
-
您能分享您选择了哪些选项以及您使用的 VS 版本吗?工具集版本也可能有所帮助。
-
最新的 msvc 15.7 。实际上不是在本地使用它(使用 Linux),而是安装在我们的 Windows 构建服务器上。
标签: c++ visual-studio msbuild tfsbuild