Visual Studio Publish to Azure Linux App Service Fails

Mike Rowley 26 Reputation points
2020-04-14T23:01:38.087+00:00

I am getting an error trying to publish to an Azure Linux App Service the second time I publish.

The first time after the service is created it works, subsequent updates fail with:
Unable to add XXXX.dll to the Web site. The process cannot access the file because it is being used by another process (550).

If I turn on Delete Existing files, the publish fails with:
Error deleting file runtimes. Cannot remove folder runtimes/unix/lib/netcoreapp2.1

I have even gone so far as to delete the App Service and recreate it from scratch and get the exact same errors after the initial publish. I have also tried to FTP via FTP Client to the site and manually delete the runtimes/unix/lib/netcoreapp2.1 folder and get an error manually deleting it as well.

I am publishing a netcoreapp3.1, framework independant portable runtime with a release configuration via FTP using the publishing profile downloaded from the Azure Portal.

It seems like a problem in Azure with permissions or files not being properly released or something.
Any suggestions on what the problem is or how to resolve it?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,967 questions
{count} vote

Accepted answer
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2020-04-15T09:27:43.593+00:00

    Thanks for asking question! If I understood right the updates fail with: Unable to add XXXX.dll to the Web site when trying to publish to an Azure Linux App Service. If so to fix this add the appOffline=true to the ARM template or use the AppOffline switch to the MSDeploy.exe command line.

    Also, another option you may try is to rename locked files.

    Set MSDEPLOY_RENAME_LOCKED_FILES=1 to Azure App Setting on your app. This causes msdeploy to attempt to rename DLLs if they can't be copied during deployment. This often works because even when DLLs are loaded, they can typically still be renamed. It renames them with a .delete extension, which it then cleans up on the next round.

    You may refer to below link for more details on this:

    https://github.com/projectkudu/kudu/wiki/Dealing-with-locked-files-during-deployment


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.