Search code examples
visual-studioazureweb-publishing

Visual Studio Publish Profile: Delete specific folder on the server before publishing


Is there a way for a Web Deploy operation to Azure App Services to delete a specific folder on the server before the deployment starts?

I need certain files to be removed on the server when they are removed on the solution and deployment leaves those files intact on the server which is causing issues.

Is there any way to add this to the publishing profile as a pre-publish action?

Just to add more context, this is an ASP.NET project using C#. Sitecore is the CMS.


Solution

  • i have tried to find something specific to the SiteCore and not msbuild BeforePublish target, but it looks like you have two options here:

    1) Use msbuild BeforePublish target

    2) Use Visual Studio Team Services build Continuous Integration - it will need some additional manual tasks, but nothing serious and it is much more visual than msbuild.

    I would highly recommend to try the second option - here, you can specify build steps like Take sources => build => execute some command (here is your place to put something for deleting the files) => publish.