There have been a number of occasions recently where I have wanted to recompile, rename or delete a DLL, only to be thwarted by some locking problem:
I had no idea what was locking it.
My first investigations took me to this MSDN Blog Site. To summarise, you can utilise the little-known tasklist command-line interface. Typing tasklist /m thelocked.dll will list all processes that are locking your DLL.
Microsoft has also made available a tool that (probably) hooks into this. Process explorer provides a more visual overview of processes and dependencies. It’s also useful for tracking down DLL-version problems or handle leaks, and provide insight into the way Windows and applications work.
But the most useful tool for me by far was a tool called Unlocker. Upon installing the little application I was automatically prompted of processes that were locking a file when I get the access denied error.
So there we have it. A number of ways in which you can tackle this issue, and maybe even help extract yourself from DLL Hell!