I am running Visual Studio 2010 on a Windows 7 VM and trying to build a fairly large solution. When I try to do so, I get the error:
Cannot register assembly "C:\Development\ProjectName\Source\bin\Debug\AssemblyName.dll" - access denied. Please make sure you're running the application as administrator. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
I have taken the following steps:
I have also found that building the project which creates AssemblyName.dll, manually registering it with RegAsm, and then building the project which requires AssemblyName.dll does not result in an error, but this is not a desirable workaround as it requires manual control. Can anyone give me some advice on how to solve this problem?
Many thanks.
This particular issue happens when you are building an assembly project which has the 'Register for COM interop' checked under the Compile tab of the project properties. As Stephane said, you must right click -> Run as Administrator in order for it to register automatically.
If you already have the compiled assembly from a different machine, you can alternatively register it manually and reference the compiled assembly with the project to by-pass the issue.