【问题标题】:The imported project "C:\Microsoft.Cpp.Redirect.14.props" was not found未找到导入的项目“C:\Microsoft.Cpp.Redirect.14.props”
【发布时间】:2018-02-23 05:35:58
【问题描述】:

我在将 .vcxproj 文件从 VS2012 转换为 VS2017 时正在编辑它,现在该项目无法在 VS2017 中加载。这是错误消息:

无法读取项目文件“Manager.vcxproj”。 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Redirect.props(27,3):导入的项目“C:\Microsoft.Cpp.Redirect .14.props”没有找到。确认声明中的路径正确,并且该文件存在于磁盘上。

我认为错误与项目文件中的这些行有关:

 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>

但是,我的解决方案中的其他项目使用相同的导入路径并且仍然可以正确加载。这些线是导致问题的原因吗?如果是这样,正确的路径是什么?为什么我的其他项目在使用此路径时可以工作?

【问题讨论】:

  • 你没有原版(版本控制)?您可以创建一个新项目并比较 .vcxproj 文件。
  • 谢谢@JeroenHeier 为 VS2017 构建的 main 中的代码也有这个问题,但我发现了几年前团队试图将项目移植到 VS2015 时的一个搁置集!

标签: c++ visual-studio


【解决方案1】:

可以通过在“全局”属性组关闭后添加以下代码段来修复该错误:

&lt;Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /&gt;

虽然项目可以在没有此行的情况下在 VS2012 中加载,但在 VS2017 中则不能。

【讨论】:

    猜你喜欢
    • 2010-09-05
    • 1970-01-01
    • 2015-09-02
    • 1970-01-01
    • 2011-11-06
    • 1970-01-01
    • 2021-12-31
    • 2021-08-19
    • 2017-12-26
    相关资源
    最近更新 更多