Link to home
Start Free TrialLog in
Avatar of corduroy9
corduroy9

asked on

VB.NET project refrence C++ DLL

When I try to reference a C++ DLL from a VB.NET Project I get this error message.  

"A reference to '..... dll' could not be added.  This is not a valid assembly or COM Component.  Only assemblies with extension 'dll' and COM components can be referenced.  Please make sure that the file is accessible, and that it is a valid assembly of COM component."

I know the dll works because it is currently working in a VB.60 Project.  Any Ideas yet?
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What I use to do in that situations is to create a VB6 DLL Wrapper to be used into VB.NET. That makes life much more simple.

At VB6 create a project that access the functions you need in the C++ DLL. The VB6 functions have to be dessigned with byref parameters and always with simple types (Int, String, etc). Then your VB.NET app talks only with the VB6 DLL without any trouble related to unmanaged code and so on ...

I've used this approach on several projects with success.

Hope it helps!