how to convert .NET class to com component

G

guoqi zheng

I would like to convert my .NET class .dll file into com component, so that
other people can use it from asp or vb6.0.

Any tutorial how to do this?

regards,

Guoqi Zheng
http://www.ureader.com
 
W

Wiktor Zychla

I would like to convert my .NET class .dll file into com component, so that
other people can use it from asp or vb6.0.

Any tutorial how to do this?

regards,

Guoqi Zheng

there are many pitfalls waiting but it can be done.

steps:

1. make sure that your public classes implement public interfaces
(interfaces are required for proper COM Interop).
2. add GuidAttribute() to classes and interfaces (you do not want to have a
new guid everytime you recompile your .NET code)
3. add a strong signature to the library (produce it with sn.exe -k, put the
file name into AssemblyKeyFile attribute) (required to register the library
in GAC)
4. add the library to the GAC (gacutil.exe)
5. register the library for COM interop with regasm.exe

all public types from your library are now registered for COM Interop but
you cannot add a reference to the library in vb6 because the file is still
..NET library.

6. use tlbexp to export your types to *.tlb file with tlbexp.exe.
7. add a reference to the tlb file in your vb6 project.

regards,
Wiktor Zychla
 
G

guoqi zheng

Sounds not very simple. I give up for now then, I am in a kind of hurry.

But by the way, do you know some where a detail tutorial about how to do
this?

regards,

Guoqi Zheng
http://www.ureader.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top