We occasionally run into issues where deployments fail because someone has a file open in a folder we are deploying to.
The odd part is, the folder becomes inaccessible after the failure.
We run a PowerShell script which cleans the install directory. It silently continues on errors.
Copy package contents result:
System.UnauthorizedAccessException: Access to the path 'F:\Web\Views\Transaction\Index.cshtml' is denied.
During delete power shell script:
Get-ChildItem : Access to the path 'F:\Web\Views\Transaction' is denied.
We cannot do anything with the folder from Windows explorer, it acts as if the folder is corrupted.
Once we kill the process which is holding a reference to the file/folder, it disappears from view and is fully deleted.
I know it is not recommended to deploy releases to the same location, but in this case we need to.