p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   General .NET (http://p2p.wrox.com/forumdisplay.php?f=122)
-   -   COM component with C# (http://p2p.wrox.com/showthread.php?t=19599)

sangata October 8th, 2004 08:57 AM

COM component with C#
 
Hi,

i have the following question:

Can I create a normal COM component with C#, which to register in Windows and use like, lets say COM component created with VB6, instantiating objects with CreateObject() in other Environments like VBA for example? Or add it as a Reference to VBA, or VB6 projects?

Because the .dll that i produced with .NET & C# is one i can add to another .NET project, but i can't add it to VBA as a reference neither can i register it in Windows, so i can use CreateObject().

Thanks in advance.
Alex


Hal Levy October 11th, 2004 01:21 PM

I don't think this can be done.

Hal Levy
I am here to help you, not do it for you.

pradeep_itguy October 11th, 2004 11:58 PM

Yes I think if you create a Component in C# it will require .NET Framework, so while running that component you need Framework without that you cannot run. So it is not possible I think.



It is not how much we do,
but how much love we put in the doing.

-Mother Theresa

planoie November 5th, 2004 04:10 PM

You can use a .NET assembly in COM. There is a setting in the project properties to register the assembly for COM interop. Of course, as mentioned, you must still have the .NET framework on the machine because the underlying code is still managed .NET code.

Property Properties -> Configuration Properties -> Build -> Register for COM Interop

You can perform this manually with the Assembly Registration Tool (Regasm.exe) found in the framework directory. Here's what MSDN says:

"The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. Once a class is registered, any COM client can use it as though the class were a COM class."

http://msdn.microsoft.com/library/de...lregasmexe.asp


Also, if that doesn't get you what you need, you can use the Type Library Exporter (Tlbexp.exe) found in the Visual Studio SDK to create a COM consumable type library. Take a look at MSDN for more details:

http://msdn.microsoft.com/library/de...rtlbexpexe.asp


All times are GMT -4. The time now is 04:30 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.