Every once in a while, typically when I stop debugging in our UI assembly, I get the following error which requires a restart of Visual Studio 2008 and it's killing my productivity:
Error 13 Unable to copy file [UI assembly] to [output directory]. The process cannot access the file [output directory][UI assembly] because it is being used by another process.
After restarting, I get this error:
Error 1 Metadata file [utility function assembly in RELEASE folder] could not be found.
I find this really, really odd because we never use the Release configuration.
I'm using VS 2k8 SP1 on Windows Vista.
I know that it's the VS debugger that's not releasing its file handle by using the handle utility (formerly from Sysinternals). The process is devenv.exe.
I've tried closing and reopening the solution. Didn't work. Only a full VS2k8 restart works.
I've tried adding a pre-build event, to move the file as described here, but that doesn't work because Windows can't delete the file for the same reason it can't replace it: it's got an open handle.
I even tried manually closing the handle using the handle.exe util described above, then trying the pre-build event. Visual Studio apparently doesn't know its handle has been closed because the VS build fails, but handle.exe shows no open file handles on the file in question.
For the record, here are the add-ins I run:
- ReSharper 4
- Smart Paster 2008
- Typemock Isolator
- TestDriven.NET 2.13.2184
I also use Developer Express controls for this project, so that may have something to do with it as well.