用VS不同版本打开项目,报错:MS Build Error MSB4019: Microsoft.WebApplication.targets was not found

本例是在用VS2008打开项目是报错 未找到C:\Program Files\MSBuild\Microsoft\VisualStudio\V10.0

In the last article Build and deploy web application project using NANT script i discusses how various options and configurations can be set on command line to overrride settings in Microsoft.WebAppliction.targets file. Well that worked perfectly fine. I was configuring a new build server for doing automated builds of the web application. I started getting following build error.

error MSB4019: The imported project "C:\ProgramFiles\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import>declaration is correct, and that the file exists on disk

Well this project was building fine on older machine. There are two options to fix this error.

Keep in mind that my development machine (from where I queue my build) is different than my TFS build machine.

So, there are two solution to this problem:

  1. Install Visual Studio 2010 (or the same version as in development machine) in your TFS server.
  2. Copy the “Microsoft.WebApplication.targets” from development machine file to TFS build machine.
The “Microsoft.WebApplications.targets” file is normally located under: “C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications”. The file will need to be copied to same path in TFS build machine.

That should take care of your build problems.

 

更详细的解答可以见:stackoverflow  或者http://stack247.wordpress.com/2011/08/29/the-imported-project-microsoft-webapplications-targets-was-not-found/

posted @ 2014-04-24 09:12  藤露  阅读(1877)  评论(0编辑  收藏  举报