为什么MSBuild在C:\中查找Microsoft.Cpp.Default.props而不是c:\ Program Files(x86)\ MSBuild? (错误MSB4019) [英] Why does MSBuild look in C:\ for Microsoft.Cpp.Default.props instead of c:\Program Files (x86)\MSBuild? ( error MSB4019)

查看:462
本文介绍了为什么MSBuild在C:\中查找Microsoft.Cpp.Default.props而不是c:\ Program Files(x86)\ MSBuild? (错误MSB4019)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行msbuild来构建vc2010项目时,出现以下错误:

When I run msbuild to build a vc2010 project I get the following error:

error 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.

  • msbuild位于c:\ Program File(x86)\ MSBuild
  • HKLM \ SOFTWARE \ Wow6432Node \ Microsoft \ MSBuild \ ToolVersions \ V4.0 VCTargetsPath设置为$(MSBuildExtensionsPath32)\ Microsoft.Cpp \ v4.0 \
  • 在将msbuild/verbosity:diag作为良好系统运行时,显示MSBuildExtensionsPath32,MSBuildExtensionsPath64,MSBuildExtensionsPath设置为构建开始时的环境
  • 在外壳中
  • 将MSBuildExtensionsPath32,MSBuildExtensionsPath64,MSBuildExtensionsPath设置为环境变量不会导致它们在构建开始时显示为环境
    • msbuild located c:\Program File (x86)\MSBuild
    • HKLM\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolVersions\V4.0 VCTargetsPath set to $(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\
    • when running msbuild /verbosity:diag as good system shows MSBuildExtensionsPath32, MSBuildExtensionsPath64, MSBuildExtensionsPath set as Environment at start of build
    • setting MSBuildExtensionsPath32, MSBuildExtensionsPath64, MSBuildExtensionsPath set as environment variables in shell doesn't cause them to show as Environment at start of build
    • 尝试修复

      • 未安装.net 4.5,已修复.net 4.0
      • 在系统变量中设置MSBuildExtensionsPath32,MSBuildExtensionsPath64,MSBuildExtensionsPath.

      似乎没有正确设置MSBuildExtensionsPath32,设置MSBuildExtensionsPath没有帮助

      It appears that MSBuildExtensionsPath32 isn't being set properly and setting MSBuildExtensionsPath doesn't help

      SET MSBuildExtensionsPath="C:\Program Files\MSBuild"
      

      如果您有任何想法要阻止此变量的正确设置,请告诉我.

      Please let me know if you have any ideas what's blocking the proper setting of this variable.

      推荐答案

      对于那些未遵循MS规定的命令的人(请参阅 Xv的答案),您仍然可以解决问题.

      For those who didn't follow the MS proscribed order (see Xv's answer) you can still fix the problem.

      MSBuild使用VCTargetsPath来查找默认的cpp属性,但不能这样做,因为注册表缺少此字符串值.

      MSBuild uses the VCTargetsPath to locate default cpp properties but cannot because the registry lacks this String Value.

      检查字符串值

      • 启动注册
      • 导航到HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0
      • 检查VCTargetsPath键.该值应="$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\"
      • Launch regedit
      • Navigator to HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0
      • Inspect VCTargetsPath key. The value should = "$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\"

      要修复

      • 将regedit Navigator启动到HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0
      • 添加字符串值VCTargetsPath
      • 将值"设置为"$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\"
      • Launch regedit Navigator to HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0
      • Add String Value VCTargetsPath
      • Set Value to "$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\"

      注意:HKLM代表HKEY_LOCAL_MACHINE.

      这篇关于为什么MSBuild在C:\中查找Microsoft.Cpp.Default.props而不是c:\ Program Files(x86)\ MSBuild? (错误MSB4019)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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