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?
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://www.emptyloop.com/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.
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
This may be caused by Visual Studio requiring administrator rights on Windows 7 or higher. To check, see whether the registry key mentioned below is set. If not, copy into a .reg
and merge. Be sure to check that your Visual Studio 2005 installation path in the .reg
file is correct!
Windows Registry Editor Version 5.00
; Run Visual Studio 2005 with administrator rights
; This is required to run / debug the program directly from the IDE
[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"C:\\Program Files (x86)\\Microsoft Visual Studio 8\\Common7\\IDE\\devenv.exe"="~ RUNASADMIN"
User contributions licensed under CC BY-SA 3.0