During our production builds, a very large (10 megabyte) static content file in the root directory will sometimes be locked by IIS and cannot be deleted by the clean task. This is presumably because it is being actively served to one or more clients at the time.
The build process stops the website before cleaning via
c:\Windows\System32\inetsrv\appcmd.exe stop site http://oursite.com
However, this does not release the file - we have to restart IIS to get the process to relinquish its lock.
appcmd.exe allows you to take IIS down completely; we do not want to do this!
Are there any other ways to get IIS to let go of a locked file, without restarting IIS? Simply stopping and starting the individual website is definitely not working to release the file lock.