WebDeploy/MSDeploy Quick Tip: Keep existing files during deployment

By default WebDeploy/MSDeploy will clear the target before deploying the new files.  In most cases this is preferred it will help to avoid “works on my machine” issues and generally to keep all your environments more similiar. 

You can instruct WebDeploy to not delete existing files on the server from MSBuild using the following MSBuild argument:

/p:SkipExtraFilesOnServer=true

OR during the MSDeploy deployment using the following argument:

-enableRule:DoNotDelete

Leave a Reply