20

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>
Community
  • 1
  • 1
amhed
  • 3,649
  • 2
  • 31
  • 56
  • put that folder outside of your solution directory. Ideally, create your virtual directory a level above the IIS Root. – Dave Alperovich Feb 28 '13 at 21:35
  • interesting. This is how I had our IIS admin create ours. He created another directory for upload images. I'll ask him when I can if you don't get an answer. – Dave Alperovich Feb 28 '13 at 21:40
  • Oh sorry, didn't read that right. I can't really configure the folders outside since this is being implemented inside an Azure Website (not a web role where I can tinker with the IIS settings) – amhed Feb 28 '13 at 21:48
  • I realized that from your past posting. I know we have done this exactly. Have to speak with our admin for details. – Dave Alperovich Feb 28 '13 at 21:55
  • Hey @DaveA did you get a change to talk to your SysAdmin? thanks again! – amhed Mar 01 '13 at 19:12
  • Yes I did, apparently we ended up using BLOB storage. When we get down time, He'll explain the details to me. For now he directed me here http://www.windowsazure.com/en-us/develop/net/how-to-guides/blob-storage/ – Dave Alperovich Mar 01 '13 at 19:35
  • Yeah, we can't move the data from that folder into Azure. It's part of the Umbraco CMS. We'd have to modify their source in order to make it work with the BLOB Storage :S – amhed Mar 01 '13 at 19:53
  • ouch. I know nothin bout Umbraco except its painful. – Dave Alperovich Mar 01 '13 at 20:36
  • I'm having this exact issue with umbraco - any resolution yet? – Matt Whetton Feb 19 '14 at 16:40

2 Answers2

2

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.

EricF
  • 173
  • 7
  • Hey @ericF after I downloaded the publish profile I edited the settings and unchecked the "delete additional files at destination" option. I've read that sometimes that option doesn't work which is why I'm trying out the Skip rules on wpp.targets – amhed Mar 01 '13 at 12:28
1

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.

Digbyswift
  • 10,310
  • 4
  • 38
  • 66