Blog Post

Microsoft Developer Community Blog
1 MIN READ

Visual Studio Team Services: Azure Web App Deployment failure - ERROR_FILE_IN_USE

chilberto's avatar
chilberto
Iron Contributor
Feb 12, 2019

First published on MSDN on May 22, 2016

Authored by Jeffrey Chilberto

 

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:

 

 

Updated Dec 08, 2020
Version 2.0
No CommentsBe the first to comment