Deploying C# .dll's

T

Tom Roach

VB 6.0 test project wants to make use of my first new C# .dll, but attempts
to register it via regsvr32 return error messages ("...loaded, but the
DllRegisterServer entry point was not found...does not appear to be a
..DLL"), as does Add-Reference Browsing to the .dll in VB 6.0 ("can't add a
reference to the specified file"). Can someone explain the
registration/reference process in a case like this?

Thanks for your help!
 
C

Carl Daniel [VC++ MVP]

Tom said:
VB 6.0 test project wants to make use of my first new C# .dll, but
attempts to register it via regsvr32 return error messages
("...loaded, but the DllRegisterServer entry point was not
found...does not appear to be a .DLL"), as does Add-Reference
Browsing to the .dll in VB 6.0 ("can't add a reference to the
specified file"). Can someone explain the registration/reference
process in a case like this?

First off, you really should post this to a VB6 or C# newsgroup - this is
C++.

The difficulty you're running into stems from the fact that a .NET assembly,
such as a C# DLL is not a registerable COM object. VB6 can only "talk to"
COM objects through the "Add Reference" mechanism.

There is a tool supplied with the .NET framework and Visual Studio called
regasm.exe. You can use this tool to register a .NET assembly for use via
COM and generate a TLB (type library) for that assembly. You can then use
Add-Reference in VB to add a reference to the registered type library. If
you need your C# class to implement (or expose) a specific COM interface,
then there are special attributes that you may need to apply to your C#
class (in the source code).

-cd
 

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

Top