4

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 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.