Hi,
we have a software architecture that allows extension via providing COM dlls
with specific interfaces implemented. Although we switch the code to .NET,
we need to handle old and new COM dlls that extend our product. Part of the
initialization of such extensions is the registration of the com dlls that
we used to do from code, using LoadLibrary and GetProcaddress. As I have
found out, this method cannot be used in .net, but I do not really like the
regsvr32 solution. Is there any other way for registering a COM dll from C#?
Thank you,
Jozsi
James Woodall - 07 Jun 2005 22:40 GMT
Hi,
Use the RegistrationServices class inside System.Runtine.InteropServices.
This essentially provides the same solution as regasm which when given a
.net assembly will register it as COM.
You need to make sure that your interop classes are assigned GUID's and the
ones you want to hide to use [ComVisible(false)] on the class declaration.
If you supply COM install and uninstall methods you can perform actions when
the assembly is registered (Registry settings etc). Just supply
[ComRegisterFunctionAttribute] and [ComunregisterFunctionAttribute] to the
methods you want to use for registration and unregistration respectively.
Have fun,
-james
> Hi,
>
[quoted text clipped - 8 lines]
> Thank you,
> Jozsi
Phil Wilson - 08 Jun 2005 02:29 GMT
Depending on your architecture and operating systems you support, see if
there's anything in the side-by-side COM without registration, using XML
configuration files. In effect you'd be adding a new COM DLL and altering
the content of manifest files that say what is implemented in the COM Dll
instead of adding the Dll and registering it again. See if this helps:
http://www.simple-talk.com/2005/03/09/com-server-registration/

Signature
Phil Wilson
[Microsoft MVP-Windows Installer]
> Hi,
>
[quoted text clipped - 9 lines]
> Thank you,
> Jozsi