Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2005

Tip: Looking for answers? Try searching our database.

Registering a COM dll from C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jozsef Bekes - 07 Jun 2005 13:24 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.