2021年3月31日星期三

Azure Devops : How to enable the Rename locked files (RenameFilesFlag) with an "IIS web app deploy task"

I'm having a problem with a locked DLL file while I tried to deploy with a Release Pipeline in Azure Devops.

The screenshot of the error is:

enter image description here

Output as text:

2021-03-31T17:43:18.2626492Z ##[error]Error Code: ERROR_FILE_IN_USE  More Information: Web Deploy cannot modify the file 'Microsoft.Data.SqlClient.SNI.x64.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.      Error count: 1.  

It seems the problem is caused by a wrongly disposed .NET resource. (ex: unmanaged SqlConnection) Anyway, I can't change the source code.

Here is my Release Pipeline.

Azure Devops Release Deploy

Here are my questions:

Q1) I'm trying to use the "-RenameFilesFlag" (MSDEPLOY_RENAME_LOCKED_FILES) as described here:

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-rm-web-app-deployment?view=azure-devops

web.config file locked during Azure App Service Deploy task

How do I have to specify this argument ? Do I have to fill the "Additional arguments" textbox ? I tried different values and I always get an "Unrecognized argument" error.

Q2) If the "-RenameFilesFlag" is not available for this task. Can I use the "Take App Offline" to unlock a file ?

Q3) On another post on StackOverflow, I saw a checkbox option specific to "Rename locked files" Getting ERROR_FILE_IN_USE while using Web Deploy in Azure App Service Task v3

I don`t have this option in my task. Is it possible that I am confusing two type of Deploy tasks ?

https://stackoverflow.com/questions/66897196/azure-devops-how-to-enable-the-rename-locked-files-renamefilesflag-with-an April 01, 2021 at 09:08AM

没有评论:

发表评论