Fix: File In Use Error in Release Pipeline while deployment
We might see in regular with an error with the above statement while doing a deployment to the IIS server in Release Pipeline using Azure DevOps.
This error is not seen often but when it is triggering the CI/CD at backend/scheduled at late night and client call to fix this is really a nightmare. The reason for this issue is, some other process using this particular file and we are trying to replace it via deployment as part of the Continuous Deployment process.
To fix this issue, we need to pass additional arguments (-usechecksum) via release pipeline as follows which will make sure to replace/move only files that are changed at source and also it gives more performance and improves the deployment time.
Additionally, we need to check the “Take App Offline” option, which makes sure to offline the service before starting Sync functionality.