Microsoft.WebApplication.targets

MrMins picture MrMins · Jul 31, 2014 · Viewed 10.7k times · Source

I have a problem when I check in my server to my build server (using TFS), but for some reason, return me the next error:

Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException)
Exception Stack Trace:    at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Adn as detail:

\WcfService4.csproj (92): 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.

I'm not sure what is the problem or what I can solve it. Someone can help me?

Answer

James Woolfenden picture James Woolfenden · Jul 31, 2014

Your reference to

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets"

This works if the build is done on a machine that has Visual studio installed on it. If you change the reference to use nuget instead- https://www.nuget.org/packages/MSBuild.Microsoft.VisualStudio.Web.targets/ this package is the equivalent one to your local file. In your csproj.

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

to (for example)

<Import Project="$(Yourpackageslocation)\MSBuild.Microsoft.VisualStudio.Web.targets\Microsoft.WebApplication.targets" />

You'll need to edit your csproj to point to the Nuget packages file.