Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using C# assemblies from VB6 code. Some issues

I have a C# assembly, which is regasmed, but is not in the GAC. In my VB6 code, I added a reference to the generated type library (the .tlb file).

Then I instantiate the C# lib in my VB6 code. If I run it from the VB6 IDE, it does not work. The Set in the code below:

Dim obj as MyCSharpNamespace.MyCSharpObject
Set obj = New MyCSharpNamespace.MyCSharpObject

causes this error:

Automation error 
The system cannot find the file specified

However, if I compile the VB6 project to an EXE and run it, it runs perfectly fine.

I should add that all the VB6 project files (e.g. forms, modules, etc...) are in the same folder as the C# DLL and TLB.

So why can't I run it from the IDE environment?

like image 298
AngryHacker Avatar asked Mar 11 '26 02:03

AngryHacker


1 Answers

Use the /codebase switch when running regasm.

like image 71
wqw Avatar answered Mar 12 '26 17:03

wqw