Exposing a class library written in VB.NET to VB6, issues

R

Richard

I've created a large project in VB.NET for the company I work for.
Another programmer has been maintaining and adding to previous code
that the company owns...written in older versions of VB, mainly VB6. He
is wanting to add some of my classes to his project for additional
features. Since I'm at home with OOP, I've gone about a solution as
follows:

1)Since its just business logic, I've created a .NET Class Library out
of the classes he is wanting to use. It's been awhile since I've used
VB6, so I've done extra measures (like ridding of overloaded methods)
to try to make sure the library will be compatible...to be safe than
sorry later.

2) Tested the libraries in .NET..alls good.

3) Created an interface for the Library. Essentially there are only 4
methods needed to be exposed through COM Callable Wrapper. The wrapper
is a completely new area of .NET for me...So, I used the following 2
tutorials:
http://www.codeproject.com/dotnet/nettocom.asp?df=100&forumid=14076&exp=0&select=792790
http://www.vbrad.com/pf.asp?p=source/src_real_interop.htm

4) Now I can't get the project to compile with the IDE's project
property "Register for COM Interop" enabled. I get the error:
"COM Interop registration failed. Type library exporter encountered an
error while processing '<MyProjectName._InterfaceName>,
<MyProjectName>'. Error: Element not found." What does this mean? What
element? Where?

Going another route, I created a Strong Name key and put this in my
AssemblyInfo.vb file:
"<Assembly: AssemblyKeyFile("c:\MyPath\MyKeyName.snk")>"
Then I turned off the option for "Register for COM Interop". Thinking
that this would allow me to register the Library myself using
regasm.exe.
However, it still will not compile since I'm using 2 3rd-party .NET
Libraries referenced in my project. It gives me the error:
"Unable to emit assembly: Referenced assembly '3rd-party Library' does
not have a strong name"

I've tried using tlbimp.exe with a strong named key to register the 3rd
party libraries, but since they are not COM, it can't be done.

Does anyone have a clue how to get something like this to compile and
register? I have no problems creating libraries from .NET to be used in
VB6 without referencing 3rd-party class libraries, but without these
3rd-party libraries, my code is useless.
 
G

Guest

Create a remoting wrapper around the third party libraries (kludgy, but it
can solve your problem). You can then use remoting to contact.

Another alternative is Reflection. You can use it to late bind the libraries
that are not signed. This is the harder of the two options, but the better
performing.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

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