避免删除Web Publish上的文件夹

amh*_*hed 20 deployment asp.net-mvc umbraco azure visual-studio-2012

我正在将我的应用程序部署到Azure网站.我已经配置succesfuly出版资料和设置tfspreview.com使用每个代码的持续集成提交自动发布.

我在路径"/ media"上有一个文件夹.此文件夹包含通过CMS(umbraco)上传的图片和文档.每个Web部署都会删除此文件夹.

这个答案,我学会了如何在.csproj或wpp.targets文件上添加SkipDelete规则,但每次我发布网站时,整个文件夹都会被删除.

这是我目前在wpp.targets中使用的代码:

<PropertyGroup>
<AfterAddIisSettingAndFileContentsToSourceManifest>
  AddCustomSkipRules
</AfterAddIisSettingAndFileContentsToSourceManifest>
</PropertyGroup>

<Target Name="AddCustomSkipRules">
<Message Text="Adding Custom Skip Rules" />
<ItemGroup>
  <MsDeploySkipRules Include="SkipMediaFolder">
    <SkipAction>Delete</SkipAction>
    <ObjectName>filePath</ObjectName>
    <AbsolutePath>media</AbsolutePath>
  </MsDeploySkipRules>
</ItemGroup>
</Target>

<PropertyGroup>
<UseMsDeployExe>true</UseMsDeployExe>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

Eri*_*icF 2

这不仅仅是取消选中发布向导(设置步骤)中“发布前删除所有现有文件”框的问题吗?我知道从 Visual Studio 端设置发布时可以使用该选项 - 在我看来,Azure 发布凭据只是为您提供连接,而不是您通过向导进行的设置。