views:

1926

answers:

2

Hi, I get the following error in Visual Studio 2005 when doing a build:

Error 9 Cannot register assembly "E:\CSharp\project\Some.Assembly.dll" - access denied. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) project

It happens only intermittantly and does go away if I restart the IDE, however this is incredibly annoying and I would like to put a stop to it happening permanently, if I can. I've checked the assembly itself, and it is not set to read only, so I've no idea why Visul Studio is getting a lock on it. I am working in Debug mode.

I've had a look around google, but can't seem to find anything other than "restart VS". Does anyone have any suggestions as to how I can resolve this annoying problem?

+3  A: 

It sounds like you have a DLL that gets locked every now and then, preventing VS from overwriting/locking it. Have you tried using tools like Process Explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx), or Unlocker (http://ccollomb.free.fr/unlocker/) to see what is locking the DLL? Unlocker in particular has saved me many a time.

As noted in the comments below (Thanks Jeff), you can also kill an individual lock from within Process Explorer.

Raithlin
Just installed Unlocker, and it says it didn't find a locking handle. Process Explorer says devenv.exe has the dll open in Local Settings\Application Data\Microsoft\VisualStudio\8.0\ProjectAssemblies\jl-s2cov01\Some.Assembly.dll, so it could be that.
sgrassie
Try deleting the dll, and let Unlocker figure it out (you don't have to physically delete it, unless it will be rebuilt anyway). It gives you the option to do nothing.
Raithlin
note that you can also kill individual locks from within Process Explorer -- have you tried that?
Jeff Atwood
Thanks, Jeff. Didn't know you could do that.
Raithlin
A: 

I've been getting something similar, thought I'd add this link for anyone ending up here from google: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/ba9d67b3-9d14-4a2a-ac5a-91441032ded4

queBurro