6

Scenario

  • Visual Studio 2012 web publishing: web Deploy method.
  • "Remove additional files at destination" option selected.
  • MVC3 website with a "upload" folder

Question

How to keep the existing files on destination for the upload folder without removing the "Remove addtional files..." option from the deployment settings?

huMpty duMpty
  • 14,346
  • 14
  • 60
  • 99
fcaldera
  • 584
  • 1
  • 6
  • 18
  • I dont quite get the question, you want to keep the files, but has the option to remove them enable? Could you please clarify, then I can try to help? – Ademar Oct 31 '12 at 14:49
  • Yap sure. I need the option to remove enable because I could remove views, images, scripts or other kind of content from my project, then the publication should remove those files on the server also. But not for the "Upload" folder. This folder holds files that user uploads, so the publication must not remove anything from here. – fcaldera Oct 31 '12 at 15:30
  • 1
    In summary, I need the "Remove additional..." for all folders, except the "Upload" folder. Is that possible? – fcaldera Oct 31 '12 at 15:32
  • With TFS, you could use before and after build events, which would help to copy the folder you want somewhere else, then copy it back after the build been deployed. Apart from that, I put a possible solution as an answer but have not used myself. – Ademar Oct 31 '12 at 16:41
  • This will help you for sure: http://stackoverflow.com/a/23812739/114029 – Leniel Maccaferri May 22 '14 at 16:48

1 Answers1

1

Apparently you can do it with wpp.targets file. Then skip only the folder you want...

<ItemGroup>
  <MsDeploySkipRules Include="SkipErrorLogFolder1"> 
    <SkipAction>Delete</SkipAction> 
    <ObjectName>FolderPath</ObjectName> 
    <AbsolutePath>ErrorLog</AbsolutePath> 
  </MsDeploySkipRules> 
</ItemGroup>

Have a look here, see first there:

MSbuild command line parameter for skipping the directory

Community
  • 1
  • 1
Ademar
  • 5,657
  • 1
  • 17
  • 23
  • 2
    I seems this only applies when using the "Web Deploy Package" method, but not for the "Web Deploy". The MsDeploySkipRules does not work in this scenario. Thanks for the answer. – fcaldera Nov 23 '12 at 17:09
  • Yep. By using the command line of the generated package. But not from visual studio using "Web Deploy". In that scenario the skip rules doesn't works. – fcaldera Nov 27 '12 at 19:16
  • BTW, I've followed this blog: "http://blog.alanta.nl/2011/02/web-deploy-customizing-deployment.html" that I found in this unanswered question: "http://blog.alanta.nl/2011/02/web-deploy-customizing-deployment.html" – fcaldera Nov 27 '12 at 19:18