Search code examples
azure-web-app-serviceazure-deployment

How to preserve user-uploaded files on WebDeploy in Azure


In the Azure release definition I publish the build artifact to the UAT WebApp using Azure web deploy. However this deletes any previously user-uploaded files (e.g. images).

How can I release to UAT and preserve the user uploaded files?

Do I somehow need to perform the equivalent of extracting the .zip file over the existing files rather than replacing the entire website directory with the contents of the .zip?


Solution

  • You can add the following MSBuild property to your build

     /p:SkipExtraFilesOnServer=true
    

    OR add the MSDeploy provider flag:

    -enableRule:DoNotDelete
    

    https://dotnetcatch.com/2016/02/01/webdeploymsdeploy-quick-tip-keep-existing-files-during-deployment/