Fix the Missing webapplication.targets Error on a Build Server
The Issue
I recently upgraded and converted my first solution to VS2010.On doing so I discovered that the continuous build was failing for this solution. The error that I was receiving was that the webapplication.targets file for VS2010 could not be found. Oh oh!
The imported project "C:\Program Files\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.
The targets file is essentially a build that file gives MSBuild the information it needs to kick off a web application build.
The Fixes
There are two solutions to this issue both of which are not ideal.
The first is to install VS2010 in the build server this will put all the right files in all the right places and the build will
The other is to just copy the v10.0\WebApplications\Microsoft.WebApplication.targets files from your machine where the v10.0\ WebApplications\Microsoft.WebApplication.targets are located to the directory reported in the error. The files will be located at C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\ Microsoft.WebApplication.targets
I went with the second option as the lesser of two evils, a simple fix that is easy to repeat. This fixed the issue and the build returned to being green. Happy lead developer.
Have you had this issue? Did you find a more long term fix. Leave a comment here to let me know.
11 Comments
dotnetdave said
Or at C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications on a 64 bit server.
dotnetdave said
DMac it is a little hacky but I think that having one file to manage is preferential to installing VS2010 on the build server. I try to keep my build server as clean as possible. In the future if the build breaks due to this .targets file then it is a quick fix to copy this file again, rather than upgrading VS2010. I came to the same conclution as you that these were the only two options.
Did you find any other solutions?
professor said
In general, the best solution is to put target file and library in source control, and reference it by relative path. That's the way for StyleCop, MSBuild Community Tasks and MSBuild Extension Pack. I tried to use same with this case - but it appeared that Visual Studio can't stand such changes - it supposes upgrade without changes to decline. So there were no chance to make it work okay :(
land cruiser said
Great detailed info, I just bookmarked you on my google reader.
Sent from my iPhone 4G
DMac said
We ran into this issue as well and, while copying the file into the proper directory on the build server would surely do the trick, doesn't that seem a little hacky? The other option, installing VS2010 on the build server seems equally as absurd. Is there any concern with manually copying this file over and breaking with future releases of VS2010?
I've been spelunking the web for over a day now, and these two options seem to be the only ones I can come across.
Rune said
A while since this was posted and discussed. Any new solution out there?
dotnetdave said
Unfortunately no new wisdom on this topic. Please update us on anything you find. Thanks for your comment.
bwilhite said
Thank-you very much. Saved me a good amount of frustration, I think.
Tom said
Installing the Windows 7 SDK [1] as suggested in [2] fixed the problem for us and gave us a nice warm fuzzy feeling that we didn't have to install Visual Studio.
[1] - http://www.microsoft.com/downloads/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b&displaylang=en
[2] - http://andypook.blogspot.com/2010/06/building-without-visual-studio.html
Morten said
Solution on a 64bit server ( and perhaps on a 32bit server) :
- install visual studio 2010
- choose custom install
- choose c# etc.
- AND also install "visual web developer"
Happy building:-)
Bali-Run said
Thanks! Good information.