Visual Studio / Windows 7 issue:  cannot register assembly

5563
7
10-25-2010 04:07 AM
ShaneWolf
New Contributor
My work machine was just upgraded to Windows 7, this caused a lot of problems with my Visual Studio 2008.  (all issues described here are presenting themselves in VS 2010 as well).

My issue when building projects is the following error:
Error 1 Cannot register assembly "C:\Users\sbwolf\Desktop\CVS Repository\arcgis - Copy\ExportToImage\EMF Export\bin\Release\ExportToImage.dll" - access denied. 
Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\ExportToImage.ExportToImage' is denied. ExportToImage


If I run Visual Studio as administrator and then run (Debug -> Run ) the project in ArcMap, my ArcMap gets into this odd state where only a few Feature Classes load.  If I try to fix the ones that did not, no feature classes or datasets display in the SDE connection.  Not running Visual Studio in administrator fixes this issue with ArcMap, but the COM assembly is not registered and doesn't show up in ArcMap.  FYI, the code being run is an ESRI ICommand derivative.

I'm wondering if due to Visual Studio running as administrator, ArcMap isn't in some odd execution context because it's not running the same permission level or the possibly same level as that of its supporting executables ( AppRot, etc).

Has anyone else had this problem?
0 Kudos
7 Replies
arunchanumalla
New Contributor II
did you ever resolve this ? if you did could you share how ?
0 Kudos
RichardWatson
Frequent Contributor
Turn UAC off.
0 Kudos
JeffreyHamblin
New Contributor III
Interesting problem. I have never run into it, but then I'm relatively new to Visual Studio.

I would try to avoid turning off UAC, if possible. And always running VS as admin shouldn't be necessary.

StackOverflow has a similar thread, and one of the answers seems like something to try as well:
"I believe you can turn off the auto-registration for COM components in the project settings. Register the component manually once, and let the IDE just compile the binary without registering it. You will need to re-register the component if you change the interface, obviously.. But it doesn't have to be done every single compile/debug."

Avoiding COM registration headaches is one of the nice features of Add-Ins.

-Jeff
0 Kudos
ThomasGertin
New Contributor
I had the same problem. I had to run Visual Studio as an administrator to get the build solution to show no errors
0 Kudos
CharlesShore
New Contributor
I'm creating a VS2010 (C#) AddIn, and receiving the error "Cannot register assembly "---.dll.  Could not load file or assembly '----' or one of its dependencies.  The system cannot find the file specified."  Well, the dll is there, so I have no idea what this is referring to.

I'd like to try to turn off auto-registration for COM components in the project settings, as suggested in the previous post.  However, again, there are no details on how to do this.  I realize that the project properties has a Settings property, but I can't find any documentation on how to use it.  Is that where I can set the auto-registration to false?
0 Kudos
Cristian_Galindo
Occasional Contributor III
Hi,

Disable the COM resgister option in the project properties tab, also  check that you are running in x86 cofiguration..
0 Kudos
RichardWatson
Frequent Contributor
Look at the discussion of per-user redirection:

http://msdn.microsoft.com/en-us/library/024awkd1.aspx

I am thinking that you are probably running as a user who is a member of the Administrators group.

I have run into a number of problems which end up requiring the Visual Studio be run as an Administrator.

IMHO, the easiest way to do that is to simply disable UAC.  I am talking about a development machine here and not an end user machine.
0 Kudos