Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compiling a .Net class lib as COM for vb6

Status
Not open for further replies.

ThatRickGuy

Programmer
Joined
Oct 12, 2001
Messages
3,841
Location
US
Hey all, I'm having a heck of a time with this. I have a class library writen in .Net that has references to our general class lib and a data access class lib.

This assembly is a calculation engine that a third party developer is going to use for an outsourced projected. Only problem is that they use VB6.

If I switch the "Register for COM Interop" tag on for the calculation engine, do I also need to do so for the other 2 libraries that it references? do I also need to do so for any libraries referenced by them?

Any pointers would be greatly appreciated!

-Rick

----------------------
 
Well, I manage to track down what I was looking for.

First, don't use the "Register for COM Interop". That appears to do the work for you locally, but I couldn't get the .tlb to register on other machines.

So, compile as usual. (Note that if this is something that is going to be widely distributed, now would be a great time to add a key to your project.)

Copy the .DLL file assembly and ALL assemblies it references to what ever machines you are going to be working with the COM object.

Make sure the .Net Framework is installed on that machine.

browse to:
Code:
c:\windows\Microsoft.net\framework\v1.0.3705
or
Code:
c:\windows\Microsoft.net\framework\v1.1.4322
depending on your framework version.

run the RegAsm.exe tool. This will create a Type Library(.tlb) that can be accessed as a COM object. for example:
Code:
RegAsm c:\Project1\Project1.dll /tlb:Project1.tlb

In VB6 you can then just add a reference to that .tlb file. Make sure that all of the files referenced by the original .DLL are in the same folder.

-Rick



----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top