views:

87

answers:

1

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?

+4  A: 

Use the /codebase switch when running regasm.

wqw