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.


2 Comments

Euan Gordon · 5th July 2018 at 9:22 am

I am having similar issues to those described but while publishing Azure Functions. Trying everything to try and get them to pick up newer versions of DLLs. Bit of a nightmare! You never know what code is actually going to run.

    Shinigami · 5th July 2018 at 10:13 am

    Hi Euan, yes, looks like this is also an issue with Azure Functions as well as I experienced this error yesterday. I’ve added MSDEPLOY_RENAME_LOCKED_FILES to the application settings in the portal and have successfully published but I’ve got no idea if this was the solution or if the DLLs just didn’t happen to be locked this time. Also, I agree that it’s certainly not ideal that the old DLLs are still running before they’re renamed even after the new ones have been published.

    Hopefully they’ll sort this out eventually, though maybe it’s all a cunning plan to force us to upgrade our plans to one that uses slots so they can get more money out of us!

Leave a Reply

Your email address will not be published. Required fields are marked *