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.