So sick of Microsoft.WebApplication.targets was not found build errors!


I was recently connecting an on premises build server to my Visual Studio Online account (that is crazy easy by the way) but my first build failed with the following error.

The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.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.


This is not the first time I have come across this error. Just replace “v11.0” with whatever version you want and you have been there.  In the past I would just copy files on my build machine or install countless SDK versions trying to make the build machine happy.

Not this time I wanted a much clearer solution. I connected to the build machine and found the desired file in a “v12.0” folder instead of a “v11.0” folder being referenced.   So how can I simply have build use the correct version?

Turns out you can simply pass Visual Studio Version on the Process tab of your build definition.  Under the Advanced section just add the following text to the MSBuild Arguments.


Problem solved and I don’t feel all dirty after. 

Comments are closed