At the moment I am having some issues deploying an Azure Web App (asp.net core). I always get the error that some files are locked by a process. Then I have to go to the Azure portal, stop the website (with the right slot) and retry.
Now I have solved this by adding this powershell script before the actual deployment:
We think this is a good idea. We’ve noticed that even if you restart your web-app (right before you deploy to it), Azure may still have files locked causing your deployment to fail, so the only sure way is what you’ve been doing: Stop -> Deploy -> Start.
We’ve added an internal card to investigate this as a feature on the Azure Web App step.
Another option that may be worth trying is the “Enable AppOffline” flag on the Azure Web App step. This flags gets sent through to WebDeploy as one of the deployment sync options, and is supposed to safely bring down the app domain before your deployment occurs. So this may also solve the problem of deploying to locked files during deployment.