Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft.WebApplication.targets

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?

like image 847
Benjamin RD Avatar asked Jul 30 '14 22:07

Benjamin RD


People also ask

Where can I find Microsoft Webapplication targets?

targets files from Visual Studio 2015 that can be found in the "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14. 0\{Web,WebApplications}" directories. The files are in the "tools\VSToolsPath" directory.

What is Microsoft Webapplication targets used for?

targets file. 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.


2 Answers

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.

like image 138
James Woolfenden Avatar answered Sep 20 '22 02:09

James Woolfenden


Your application is build on using MSBuild. MSBuild depends on target files that describe how certain application types need to be build.

In this case you are building a web application and your project file contains a link to the Microsoft.WebApplication.targets file. This file is installed on your local pc by installing Visual Studio but it's not available on your build server.

You have two options:

  • Copy the target file from your local pc to the build server in the correct location
  • Install Visual Studio on your build machine

To be honest, the second option is the easiest. You will probably need to copy a lot of files if you want to manually setup your build server. Installing Visual Studio takes care of all dependencies.

like image 44
Wouter de Kort Avatar answered Sep 21 '22 02:09

Wouter de Kort