tags:

views:

366

answers:

2

Im having trouble using a .NET COM in vb6, It compiles ok and I use regasm to register it, add a reference to it in the vb6 project, it even has intellisense. But when I try to make make an instance it gives me an 'Automation Error'. Any one can help?

Thanks in advance.

+2  A: 

You probably need to make sure your .NET assemblies are in the VB6 application's directory, or if debugging in the VB6 IDE that they are in the VB6.exe's directory.

It is possible to make COM interop with .NET assemblies work more like COM dlls (see the codebase option of regasm) but by default, .NET assemblies are searched for in the usual way - ie in the GAC or application directory - even when used via COM interop.

A really simple way to get insight into where your assembly should be is by using sysinternals filemon utility.

mackenir
A: 

I think you have to compile the .Net project in a certain way to be used by COM objects. And the .Net dlls need to be next to, in the same directory, as the COM object that calls them (If they occupy the same space I think).

Project Property Pages\Configuration Properties\Build\Register for COM Interop = true

ssorrrell