Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

v11.0\WebApplications\Microsoft.WebApplication.targets was not found when file actually references v10

First some background. At the end of 2012 we migrated our vs2008 solution to vs2010 but we still target .NET 3.5. (I know nothing but the latest and greatest here!)

We hadn't had any issues with this setup until a few weeks ago when people started getting these errors:

"foo.csproj" (Rebuild target) (16:5) ->   C:\...\foo.csproj(142,3): error MSB4019: 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 declaration is correct, and that the file exists on disk. 

The interesting thing is that if you look at the project file it references v10 which makes sense because we don't use Visual Studio 2012.

This error hit several of us at once and even on older code branches that haven't changed in months.

I suspect some update got pushed onto our machines that confused things but I don't know what to do about it.

The short term solution has been to install VS 2012 and not use it but I'm hoping for something a little cleaner than that.

like image 689
drs9222 Avatar asked Jul 02 '13 19:07

drs9222


People also ask

Where can I find Microsoft WebApplication targets?

"C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\5.0. 406\Microsoft\VisualStudio\v15. 0\WebApplications\Microsoft. WebApplication.

What is Microsoft WebApplication targets used for?

Essentially, this target takes the build output of your web application project and turns it into a web deployment package that can be published to an IIS web server. To view a project file (for example, ContactManager. Mvc. csproj) in Visual Studio 2010, you first need to unload the project from your solution.


1 Answers

I ran into the same issue with Visual Studio 2013. It turns out that I was using the old version of MSBuild--the one that ships with the .NET Framework--from the command line. Microsoft is now releasing MSBuild as part of Visual Studio itself and also as a separate installer (http://blogs.msdn.com/b/visualstudio/archive/2013/07/24/msbuild-is-now-part-of-visual-studio.aspx).

The solution was to use the new version of MSBuild.exe located in C:\Program Files (x86)\MSBuild\12.0\Bin. Once I did that, all the targets errors disappeared.

EDIT 1

As mentioned in the comments, each new version of MSBuild brings with it a new directory. For Visual Studio 2015, use C:\Program Files (x86)\MSBuild\14.0\Bin.

EDIT 2

As mentioned in the comments, for Visual Studio 2017, use C:\Program Files (x86)\Microsoft Visual Studio\2017\<Edition>\MSBuild\15.0\Bin\MSBuild.exe.

like image 102
NathanAldenSr Avatar answered Sep 30 '22 19:09

NathanAldenSr