Visual Studio Team Services: Azure Web App Deployment failure - ERROR_FILE_IN_USE
Published Feb 12 2019 02:04 PM 630 Views
Iron Contributor

First published on MSDN on May 22, 2016

Authored by Jeffrey Chilberto

 

Error Message.png

As part of a VSTS Release, an Azure Deployment task was failing due to a locked library file preventing the task from modifying the file.  The actual error message is shown below:

##[error]Web Deploy cannot modify the file 'NewRelic.Profiler.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE

 

The command performed by the task is Publish-AzureWebsiteProject and the command does not support taking the website offline before deployment similar to msbuild publishing.

 

 

 

Stopping the website before the deployment and starting after the deployment does release the lock.

 

 

 

For a classic web app:

 

 

 

 

 

For ARM web app:

 

 

Version history
Last update:
‎Dec 07 2020 06:02 PM
Updated by: