I have an automated build process that runs when no one in is in the office, and it pushes builds, deploys IIS web sites, and various other tasks. The problem is that if someone leaves a file open in one of these applications (like say they were looking at the web.config in a text editor), the build fails because it can’t delete the files. I’ve seen people propose a solution as using Unlocker to release the file handles, but I don’t want an interactive program – I want a command line application that I can call from the build process to release any open handles in the directory automatically.
Share
Microsoft provide handle.exe which is a command-line tool. You’d need to do some ninja parsing to interpret the output, though. Also be aware that forcing a handle closed can have very unwelcome side-effects, it might actually be safer to kill the offending process.