title: Azure Devops : How to enable the Rename locked files (RenameFilesFlag) with an "IIS web app deploy" task
body: <p>I'm having a problem with a locked DLL file while I tried to deploy with a Release Pipeline in Azure Devops.</p>
  <p>The screenshot of the error is:</p>
  <p><a href="https://i.stack.imgur.com/mVNMl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mVNMl.png" alt="enter image description here" /></a></p>
  <p>Output as text:</p>
  <pre><code>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.
  </code></pre>
  <p>It seems the problem is caused by a wrongly disposed .NET resource. (ex: unmanaged SqlConnection)
  Anyway, I can't change the source code.</p>
  <p>Here is my Release Pipeline.</p>
  <p><a href="https://i.stack.imgur.com/aMSmo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aMSmo.png" alt="Azure Devops Release Deploy" /></a></p>
  <p>Here are my questions:</p>
  <p>Q1) I'm trying to use the &quot;-RenameFilesFlag&quot; (MSDEPLOY_RENAME_LOCKED_FILES) as described here:</p>
  <p><a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-rm-web-app-deployment?view=azure-devops" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-rm-web-app-deployment?view=azure-devops</a></p>
  <p><a href="https://stackoverflow.com/questions/46154594/web-config-file-locked-during-azure-app-service-deploy-task">web.config file locked during Azure App Service Deploy task</a></p>
  <p>How do I have to specify this argument ?
  Do I have to fill the &quot;Additional arguments&quot; textbox ? I tried different values and I always get an
  &quot;Unrecognized argument&quot; error.</p>
  <p>Q2) If the &quot;-RenameFilesFlag&quot; is not available for this task.
  Can I use the &quot;Take App Offline&quot; to unlock a file ?</p>
  <p>Q3) On another post on StackOverflow, I saw a checkbox option specific to &quot;Rename locked files&quot;
  <a href="https://stackoverflow.com/questions/52503666/getting-error-file-in-use-while-using-web-deploy-in-azure-app-service-task-v3">Getting ERROR_FILE_IN_USE while using Web Deploy in Azure App Service Task v3</a></p>
  <p>I don`t have this option in my task. Is it possible that I am confusing two type of Deploy tasks ?</p>