Professional Programmer Notes

or just call this my soapbox

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

One Response

Subscribe to comments with RSS.

  1. Thanks for the help, the fact that it wasn’t a standard reference confused me.

    Erichero

    February 19, 2009 at 4:45 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: