Search code examples
.netexcelvbacomregasm

Is this a possible approach to register .NET types for COM


I have a .NET assembly and use regasm.exe to register for COM. The tlb is used by users to write code in VBA in Excel.

I did a regasm /regfile and I see that all registry entries are fallin in to 'HKEY_CLASSES_ROOT\'. I have an admin constraint (sadly) to run regasm on all user's machine since it requires admin access to write registry keys in to *HKEY_CLASSES_ROOT*.

My question is, if I change this to write to 'HKEY_LOCAL_MACHINE' or 'HKEY_CURRENT_USER', will the COM interop still work and will Excel be able to find my types ?

This way, I am thinking I can negotiate for a much less previlieges to my users so they can run this new reg file rather than runing the regasm.

Thanks Mani


Solution

  • Sadly it's not so easy 'cause it depends on user settings, take a loot at: http://blogs.msdn.com/b/cjacks/archive/2008/06/06/per-user-com-registrations-and-elevated-processes-with-uac-on-windows-vista-sp1.aspx