Microsoft.WebApplication.targets
Asked Answered
N

3

7

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?

Negotiation answered 30/7, 2014 at 22:0 Comment(3)
Did you install Windows 8 SDK?Circumrotate
@Circumrotate I'm using a windows 7 (in my build server) and .Net famework 4.5. Works? But the documentation that you sent me is Windows 8 and framwork 4.5Negotiation
@Circumrotate You can use the SDK to build applications that target these operating systems: Windows 8, Windows 7, Windows Vista, Windows Server 2012, Windows Server 2008 R2, Windows Server 2008. I'll try it, thanksNegotiation
M
20

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.

Menfolk answered 31/7, 2014 at 11:31 Comment(1)
Hi, I tried this solution and it works fine at first, however Visual Studio keeps adding an extra line to the csproj file: <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" /> this happens when opening the project with different versions of Visual Studio. Has anyone had this issue?Basle
D
1

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.

Defect answered 31/7, 2014 at 9:33 Comment(3)
The second is easier. But I do the harder one. (and manually copy the files over). Microsoft drives me nuts with this. The build-machine should not need Visual Studio. Msbuild.exe and an SDK should be enough, but they don't seem interested in plugging the gaps.Steck
@Steck The official licensing whitepaper allows you to install VS on the build machine. I see no reason for not doing it.Defect
All that's needed is the nuget package in your project, this also associates the reference with the code. You shouldn't install more than is required on a build machine.Menfolk
T
0

Either install visual studio on your build machine or copy the targets file from your local machine to the build server

Tetracaine answered 30/7, 2014 at 22:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.