问题

我们目前正在使用Visual Studio Team Services(VSTS)将我们的MVC应用程序部署到Azure Web App,并且正面临跳过规则的问题 . 我们希望在部署期间使用Web部署跳过规则跳过文件夹 Content/Uploads . 但是,似乎VSTS根本没有执行该规则 . 规则基于以下项目配置打包在 deploy.cmd 文件中 .

<PropertyGroup>
      <OnBeforePackageUsingManifest>AddCustomSkipRules</OnBeforePackageUsingManifest>
</PropertyGroup>
<Target Name="AddCustomSkipRules">
  <ItemGroup>
    <MsDeploySkipRules Include="SkipDeleteAppData">
      <SkipAction>Delete</SkipAction>
      <ObjectName>dirPath</ObjectName>
      <AbsolutePath>\\Content\\Uploads</AbsolutePath>
      <XPath></XPath>
    </MsDeploySkipRules>
  </ItemGroup>
</Target>

此配置添加以下规则

-skip:skipaction='Delete',objectname='dirPath',absolutepath='\\Content\\Uploads'

此外,如果我采用此规则并将其直接复制到VSTS aszure Web应用程序部署步骤的“Additional Argument”属性中,它就像一个魅力 .

我想知道我是否遗漏了什么 . 我尝试寻找其他线程或示例,但没有成功 . 我也试图改变 OnBeforePackageUsingManifestAfterAddIisSettingAndFileContentsToSourceManifest ,正如Make MSDeploy (Visual Studio) not delete App_Data folder but delete everything else的评论中提到的那样没有成功 .

谢谢,

更新

截至目前,我的猜测是来自VSTS的"Azure App Service Deploy"任务没有使用生成的 cmd 文件 . 它使用输入参数生成命令 . 因此,我需要在部署任务中手动添加跳过规则,而不是项目配置 .