
- Forum
- Programming Talk
- Microsoft .NET
- .NET objects to COM objects
.NET objects to COM objects
This is a discussion on .NET objects to COM objects within the Microsoft .NET forums, part of the Programming Talk category; Hi All, Can any one help me how can i expose my .NET objects to COM objects. Is that possible? ...
-
11-15-2008, 07:04 AM #1
- Join Date
- Nov 2008
- Answers
- 1
.NET objects to COM objects
Hi All,
Can any one help me how can i expose my .NET objects to COM objects. Is that possible?
Thanks in Advance!
Jazz
Last edited by jazzlearner; 11-15-2008 at 07:07 AM.
-
Yes, it is possible through COM Interop...The assembly information of a .net assembly needs to be exported as a type library and this type library could then be referenced as a COM type library in any of the COM applications.
Method 1
You will have to use the utility, tlbexp.exe (comes with the .net framework). This command-line utility takes as input the name of an assembly DLL file to be converted to a Type Library. You can also specify the name of a Type Library file to be created.
Once a Type Library has been created, it can be referenced by a COM client to obtain the information necessary for the COM client to bind to the interfaces of the COM class and activate the COM class at runtime.Code:tlbexp MyDotNetDLLExposeAsCOM.DLL /out:MyDotNetDLLAsCOM.tlb
Method 2
There's another utility that could also be used, regasm.exe. In addition to creating a Type Library, this utility also creates the Windows Registry entries necessary for making the assembly visible as a COM object to clients, as shown below.
Method 3Code:regasm MyDotNetDLLExposeAsCOM.DLL /out:MyDotNetDLLAsRegisteredCOM.tlb
This method is probably the easiest one as this means just turning ON one of the properties for your assembly within the VS.NET IDE. On the Project properties, there is a property Register for COM Interop. Setting this property to True instructs the IDE to automatically register the assembly for COM Interop each time you build it, so you don't have to perform this step manually.
HTH!!!
«
diff bet multi dimension array and jagged array
|
Object Variable or With block variable not set
»

Reply With Quote





