Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid deleting folder on Web Publish

I'm deploying my application to an Azure Website. I've configured the Publishing Profile succesfuly and setup tfspreview.com to publish automatically using continuous integration on each code commit.

I have a folder on the path "/media". This folder has pictures and documents uploaded through the CMS (umbraco). This folder gets deleted on each web deploy.

From this answer, I learned how to add a SkipDelete rule on either the .csproj or on the wpp.targets file, but everytime I publish the site the whole folder gets deleted anyway.

Here is the code I'm currently using inside 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>
like image 383
amhed Avatar asked Feb 28 '13 21:02

amhed


2 Answers

Is this not just an issue of unchecking the box in the publish wizard (settings step) that says "Delete all existing files prior to publish"? I know that option is available when setting up publishing from the Visual Studio side - it seems to me the Azure publishing credentials just give you the connection, and not the settings which you make through the wizard.

like image 160
EricF Avatar answered Nov 09 '22 03:11

EricF


Looking over the question you are linking to and the code you have supplied above, it seems that you need to change the line:

<AbsolutePath>ErrorLog</AbsolutePath>

to

<AbsolutePath>media</AbsolutePath>

as this refers to the folder you do not want to delete. ErrorLog was the folder the other question's author did not want to delete.

like image 29
Digbyswift Avatar answered Nov 09 '22 05:11

Digbyswift