How to create COM in C# class lib ?

  • Thread starter Thread starter CYShao
  • Start date Start date
C

CYShao

My company have many release programs written VB6.0 before.
Now, we want to add new functionalities in C#, and relpece old VB6
programs step by step.
Obviously, COM is a good way to do that.

In my program, I just to write a COM with C#, and invok it BV6.0
But I really can't understand why C# doesn't support "COM class"
template.( VB.Net provides this.)

I just want to know how to create COM in C# class lib ,and invoke it in VB6.

Thank you very much:-)

CYShao
 
Hi Shao,

1) Your assembly must have a strong name. Go to the "AssemblyInfo.cs"
file, and change the [assembly: AssemblyTitle("")] to include the name
of your project, like [assembly: AssemblyTitle("NETtoCOM")].

2) Right-click on your project, select the "Common properties" tab,
select "Class Library" as output type.

3) Click on the "Configuration properties tab", and set "Register for
COM Interop" to True.

That should do it.

HTH,
Michel
 
Back
Top