我有一个在Visual Studio,2013中创建的项目.
项目文件具有以下属性:
ToolsVersion ="12.0",PlatformToolset = v120.
我安装了Visual Studio 2013和Microsoft Build Tools 2015.使用MSBuild 12.0成功构建此项目.在尝试使用MSBuild 14.0构建它时,我收到错误
MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Run Code Online (Sandbox Code Playgroud)
据我了解,问题是变量VCTargetsPath没有得到评估.如果我在构建之前指定变量VCTargetsPath(值为C:\ Program Files(x86)\ MSBuild\Microsoft.Cpp\v4.0\V120),问题就解决了.
但是,如果路径不同,这种方法不是很方便.是否有可能以更优化的方式以某种方式解决问题?
注册表项及其值:
HKLM\Software\WOW6432Node\Microsoft\MSBuild\ToolsVersions\12.0\VCTargetsPath $([MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V120\'))
Run Code Online (Sandbox Code Playgroud) 我最近安装了Visual Studio 11 Developer Preview来试用它,现在我的VS 2010项目将无法打开.相反,我收到以下错误消息:
MSBuild不包含"VCTargetsPath"属性的值
我发现有人在Connect上报告了这个问题,微软的回复是:
微软发表于2011年12月2日下午5:25
Hi Afshin,感谢您的反馈.您遇到的问题已修复,适用于下一个公开发布的Visual Studio.
Jim Griesmer
Visual C++团队
太棒了.那么如何恢复VCTargetsPath以便我的项目再次运行?
"VCTargetsPath是一个工具集属性,在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0中定义."
我浏览了注册表中的VCTargetPath值,它具有以下值:
$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\
Run Code Online (Sandbox Code Playgroud)
不知道从哪里开始.有什么建议?
msbuild projects-and-solutions visual-studio-2010 visual-studio visual-studio-2012
msbuild ×2