0

What is the best practice approach to local user generated content when using Microsoft WebDeploy and Team City to deploy fixes to a site?

Using the deployment process described by Troy Hunt:

http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity_26.html

When changes are made to a site the WebDeploy agent updates the site including removing old files that are no longer needed - which is great. However in the case where a site contains user generated data (say users can upload an image which is stored as a file on disk or a simple CMS where page content files can be updated by the user), what is the best practice to prevent these files being deleted by the deployment agent?

Is there an ignore flag for certain folders? Should the user files be stored outside the root of the deployed website (Is this a security risk)?

Kaine
  • 1,285
  • 2
  • 16
  • 30

1 Answers1

1

You basically need to use MSDeploy's skip rules. This will tell MSDeploy to ignore certain files, folder, or subfolders etc.

It depends on where you implement these to what the syntax will look like. But you have the following options:

  • If your publishing through VS.Net using a publishing profile you can include skip rules here (I've taken this approach and seen it work fine). This SO question should point you in the right direction - MSDeploy skip rules when using MSBuild PublishProfile with Visual Studio 2012

  • If your using a vs.net web solution (website / web application) I later found out you can also implement skip rules in the web.config. Although the following article is a bit old the approach may still be viable - How to write skip and replace rules for MSDeploy (I havent used, or tested this approach)

  • Last, but not least, you could use MSDeploy skip rule on the command line itself. So assuming you execute msdeply directly (as opposed to via msbuild) you would need to append a skip parameter with the relevant attributes you require. Further information can be found at: Demystifying MSDeploy skip rules or Web Deploy Operation Settings (Look for the skip command reference, about 2/3 down the page) (Using publishing profiles with MSBuild ultimately makes this call for you, i've seen it in action working by using the first approach above).

Hope that helps!

Community
  • 1
  • 1
Matt Woodward
  • 1,941
  • 20
  • 24