Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the Microsoft.WebApplication.targets import do in VS 2010 web application projects?

Visual Studio 2010 seems to insist on having this import in web application projects

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

What does this import give us and is it really required?

On a side note if you remove this import with a text editor Visual studio will re-add it.

The reason i am asking is when the project is compiled on a build server that target does nor exists because visual studio is not installed.

like image 321
Simon Avatar asked Apr 28 '10 00:04

Simon


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 DeployOnBuild?

The DeployOnBuild property instructs MSBuild to run any deployment instructions in the project settings when the build of each project is complete.


1 Answers

As suggested in the comments to Raj Kaimal's answer, to get this working you can copy over the folder to the same location on the build machine.

If you want, you can also put that folder somewhere else in your machine, even relative to your project. You just need to add something to the csproj to redirect MSBuildExtensionsPath..

For example, I have the following in my csproj (works for VS2010 and VS2012):

<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<PropertyGroup>
    <MSBuildExtensionsPath32>..\lib\MSBuild.MSVS\</MSBuildExtensionsPath32>
</PropertyGroup>  
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets"/>

Then, within my lib folder (which is a sibling of the folder containing the csproj), I have copied the following directories:

  1. %ProgramFiles%\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications → MSBuild.MSVS\Microsoft\VisualStudio\v10.0\WebApplications
  2. %ProgramFiles%\MSBuild\Microsoft\VisualStudio\v10.0\Web → MSBuild.MSVS\Microsoft\VisualStudio\v10.0\Web
like image 69
Frank Schwieterman Avatar answered Oct 21 '22 13:10

Frank Schwieterman