我最近安装了 Visual Studio 11 开发人员预览版来尝试一下,但现在我的 VS 2010 项目无法打开。相反,我收到以下错误消息:
MSBuild does not contain a value for the "VCTargetsPath" property
我发现有人报告了该问题here on Connect ,微软的回应是:
Posted by Microsoft on 12/2/2011 at 5:25 PM
Hi Afshin,Thanks for the feedback. The issue you ran into is fixed for the next public release Visual Studio.
Jim Griesmer
Visual C++ Team
太棒了。那么如何恢复 VCTargetsPath 以便我的项目能够再次运行?
"VCTargetsPath is a toolset property that is defined in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0. "
我浏览到注册表中的 VCTargetPath 值,它的值是:
$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\
不知道从这里去哪里。有什么建议吗?
最佳答案
Gavin Pugh 提供的解决方案似乎可以解决问题,但我没有尝试。我在卸载 VS11 的开发者预览版后也遇到了这个问题。我想我知道真正的问题是什么。
姆拉登·扬科维奇走在正确的道路上。我的计算机上缺少以下两个(必要的)注册表项之一:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0
- key 名称:
VCTargetsPath
- 类型:
REG_SZ
- 值:
$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\
- key 名称:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\4.0
- key 名称:
VCTargetsPath
- 类型:
REG_SZ
- 值:
$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\
- key 名称:
(您可以通过键入 +R+regedit+Enter 在 Windows 中编辑注册表项)
对我来说,上面列出的第二个值是缺失的。添加后,我就可以再次使用我的项目了。
关于visual-studio - MSBuild 不包含 "VCTargetsPath"属性的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8497931/