如何在.csproj文件中设置MSDeploy设置

时间:2011-08-17 23:30:47

标签: c# asp.net asp.net-mvc-3 deployment msdeploy

有没有办法在ASP.NET MVC项目的.csproj文件中设置MSDeploy参数?特别是“skip”参数,它应跳过“Temp”文件夹。

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

..或者如何将此参数传递到MSBuild.exe参数列表?

1 个答案:

答案 0 :(得分:11)

在项目文件中定义<MsDeploySkipRules>。例如:

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