未找到导入的项目"C:Microsoft.Cpp.Redirect.14.props"

The imported project "C:Microsoft.Cpp.Redirect.14.props" was not found

本文关键字:Microsoft Cpp Redirect props 导入 项目      更新时间:2023-10-16

i在将其从VS2012转换为VS2017时正在编辑.VCXPROJ文件,现在该项目在VS2017中没有加载。这是错误消息:

无法读取项目文件" Manager.vcxproj"。C: Program Files(X86( Microsoft Visual Studio 2017 Enterprise common7 IDE vc vctargets microsoft.cpp.redirect.props.props.props.props.props(27,3(:导入的项目" C: Microsoft.cpp.cpp.cpp.cpp.redirect.credirect.redirirect.redirirect.redirirect.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>

但是,我解决方案中的其他项目使用相同的导入路径并仍然正确加载。这些行是什么原因引起了问题?如果是这样,正确的路径是什么,为什么我的其他项目使用此路径时会起作用?

可以通过在" Globals"属性组关闭之后添加以下代码段来解决错误:

<Import Project="$(VCTargetsPath)Microsoft.Cpp.Default.props" />

虽然该项目可以在没有此行的VS2012中加载,但它不会在VS2017中。