Skip to content

Deployment failed in IIS due to ERROR_FILE_IN_USE | Azure DevOps Release

  • by

This error usually occurs when you try to deploy an IIS app when the app is still up and running. Sometimes just redeploying it from Azure Devops would deploy it without any issues. But if you are still running into these issues, Follow the below steps


Step 1: Go the Release in Azure DevOps where you face this issue

Step 2: Go to WinRM -IIS Deployment

Step 3: Go to MSDeploy Additional Options

Step 4: Then choose Take App Offline

Microsoft.PowerShell.Commands.WriteErrorException: Deployment on one or more machines failed. System.Exception: Error Code: ERROR_FILE_IN_USEMore Information: Web Deploy cannot modify the file ‘xxxxx.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.

This is the error you might see when the deployment fails due to .DLL file being in use.