Azure Web App Deployment ERROR_FILE_IN_USE
When publishing a .NET Core 2.0 Web App to Azure from Visual Studio 2017 the initial few deployments seem to work as expected but after a while they often start failing with the message ERROR_FILE_IN_USE.
There’s a few proposed solutions for this, the initial one I tried was to increase the number of deployment attempts made by adding
<RetryAttemptsForDeployment>20</RetryAttemptsForDeployment> to the PropertyGroup section of csproj file. This didn’t work but another proposed solution of adding
MSDEPLOY_RENAME_LOCKED_FILES = 1 to the Web App settings did work, this apparently renames the files (even if they’re locked) and then deletes them when they are no longer in use.