且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

外部 VS2013 构建错误“错误 MSB4019:导入的项目<路径>"没有找到"

更新时间:2021-07-13 23:59:57

我遇到了同样的问题,并找到了更简单的解决方案

I had the same issue and find an easier solution

这是由于Vs2012在csproj文件中添加了以下内容:

It is due to Vs2012 adding the following to the csproj file:

<PropertyGroup>
  <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
  <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)MicrosoftVisualStudiov$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>

您可以安全地移除该部分,您的解决方案就会构建.

You can safely remove that part and your solution will build.

作为 Sielu 指出 你必须确保 .proj 文件开始使用 <Project ToolsVersion="12" 否则下次打开使用 Visual Studio 2010 进行项目,它将再次添加删除的节点.

As Sielu pointed out you have to ensure that the .proj file begin with <Project ToolsVersion="12" otherwise the next time you open the project with visual studio 2010, it will add the removed node again.

否则,如果您需要使用 webdeploy 或使用构建服务器,上述解决方案将不起作用,但您可以在构建脚本中指定 VisualStudioVersion 属性:

Otherwise, if you need to use webdeploy or you use a build server, the above solution will not work but you can specify the VisualStudioVersion property in your build script:

msbuild myproject.csproj /p:VisualStudioVersion=12.0

或编辑您的构建定义: