Professional Programmer Notes

or just call this my soapbox

Archive for February 2009

Microsoft.WebApplication.targets not found

with one comment

While setting up a non-Microsoft CI environment for an ASP.NET MVC project, I came across an interesting problem.  My build agent was unable to compile my project because it could not find the Microsoft.WebApplication.targets file, which, on the development computer is located under the C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications directory.

I wanted a quick solution, so I Googled it.  The top two sites resolved the issue by creating the path on the build server and copying the file over.  That is A solution to the problem.  I suppose another solution would be to install Visual Studio on the build agent.  But, that (borderline) defeats the purpose.

I decided to make a copy of the Microsoft.WebApplication.targets file in the folder of the solution.  Then, I opened the web project file and edited the line that points to the file.  I changed:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />

to

<Import Project="$(SolutionDir)\Microsoft.WebApplication.targets" />

The project builds successfully in both environments now!

Advertisements

Written by curtismitchell

February 1, 2009 at 12:35 pm