外部 VS2013 构建错误“错误 MSB4019:导入的项目<路径>"没有找到" [英] External VS2013 build error &quot;error MSB4019: The imported project &lt;path&gt; was not found&quot;

查看:27
本文介绍了外部 VS2013 构建错误“错误 MSB4019:导入的项目<路径>"没有找到"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过命令行而不是在 Visual Studio 2013 中构建项目.请注意,我已将我的项目从 Visual Studio 2012 升级到 2013.该项目在 IDE 中构建良好.另外,我首先完全卸载了VS2012,重新启动并安装了VS2013.我唯一的 Visual Studio 版本是 2013 Ultimate.

I am building a project through the command line and not inside Visual Studio 2013. Note, I had upgraded my project from Visual Studio 2012 to 2013. The project builds fine inside the IDE. Also, I completely uninstalled VS2012 first, rebooted, and installed VS2013. The only version of Visual Studio that I have is 2013 Ultimate.

ValidateProjects:
    39>path_to_project.csproj(245,3): error MSB4019: The imported project "C:Program Files (x86)MSBuildMicrosoftVisualStudiov11.0WebApplicationsMicrosoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
    39>Done Building Project "path_to_project.csproj" (Clean target(s)) -- FAILED.

这是有问题的两行:

<Import Project="$(VSToolsPath)WebApplicationsMicrosoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)MicrosoftVisualStudiov12.0WebApplicationsMicrosoft.WebApplication.targets" Condition="false" />

最初的第二行是 v10.0,但我手动将其更改为 v12.0.

The original second line was v10.0, but I manually changed that to v12.0.

$(VSToolsPath) 从我看到的地方延伸到 v11.0 (VS2012) 文件夹,这显然已经不存在了.路径应该是v12.0.

$(VSToolsPath) elongates from what I see to the v11.0 (VS2012) folder, which obviously is not there anymore. The path should have been to v12.0.

C:Program Files (x86)MSBuildMicrosoftVisualStudiov12.0WebApplications

我尝试在系统环境变量表中指定 VSToolsPath,但外部构建实用程序仍然使用 v11.0.我尝试在注册表中搜索,但一无所获.

I tried specifying VSToolsPath in my system environment variables table, but the external build utility still uses v11.0. I tried searching through the registry and that came up with nothing.

遗憾的是,我没有看到任何简单的方法来使用确切的命令行.我使用构建工具.

Sadly, I do not see any easy way to get the exact command line used. I use a build tool.

想法?

推荐答案

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

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

或编辑您的构建定义:

这篇关于外部 VS2013 构建错误“错误 MSB4019:导入的项目<路径>"没有找到"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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