Microsoft.WebApplication.targets

11,003

Solution 1

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.

Solution 2

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.

Share:
11,003
Benjamin RD
Author by

Benjamin RD

What is more difficult, a smart question or an ingenious answer? Contact me: [email protected] Linkedin: https://www.linkedin.com/in/benjaminrivera/ Full Stack developer - C#, Java, Node.js, Android, iOS/Swift and NoSQL.

Updated on June 13, 2022

Comments

  • Benjamin RD
    Benjamin RD almost 2 years

    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?