Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set MSDeploy settings in .csproj file

Is there a way to set MSDeploy parameters in .csproj file itself of ASP.NET MVC project? Particularly a "skip" parameter, which should skip a "Temp" folder.

-skip:objectName=dirPath,absolutePath="\\temp"

.. or how can I pass this parameter into MSBuild.exe arguments list?

like image 333
Grief Coder Avatar asked Aug 17 '11 23:08

Grief Coder


People also ask

How do I open a .csproj file?

How to open a CSPROJ file. CSPROJ files are are meant to be opened and edited in Microsoft Visual Studio (Windows, Mac) as part of Visual Studio projects. However, because CSPROJ files are XML files, you can open and edit them in any text or source code editor.

What is the purpose of the .csproj file?

csproj file tells dotnet how to build the ASP.NET application. It's one of the most important files in an ASP.NET project. An ASP.NET project can depend on third-party libraries developed by other developers.

What is an ItemGroup in Csproj?

In addition to the generic Item element, ItemGroup allows child elements that represent types of items, such as Reference , ProjectReference , Compile , and others as listed at Common MSBuild project items.


1 Answers

Define <MsDeploySkipRules> in the project file. For example:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <OnBeforePackageUsingManifest>AddSkipRules</OnBeforePackageUsingManifest>
  </PropertyGroup>
  <Target Name="AddSkipRules">
    <ItemGroup>
      <MsDeploySkipRules Include="SkipTempDirOnDeploy">
        <SkipAction></SkipAction>
        <ObjectName>dirPath</ObjectName>
        <AbsolutePath>$(_Escaped_PackageTempDir)\\Temp$</AbsolutePath>
        <XPath></XPath>
      </MsDeploySkipRules>
    </ItemGroup>
  </Target>
</Project>
like image 175
Konstantin Tarkus Avatar answered Oct 11 '22 07:10

Konstantin Tarkus