tags:

views:

194

answers:

1

I have a DLL (Test.dll) which contains some Excel Addin, i don't know which version this is build with (might be with VB6, but i am not sure).

When i tried referencing this DLL in the VS2008 i get the message

A reference to the <DLL Name> could not be added. Please make sure that the file is accrssible, and that it is a valid assembly or COM Component.

If anyone could please help me in this, it will be great.

Any help is appreciated.

Thanks and Regards, Tushar

+3  A: 

Hi,

It seems to me the DLL you're trying to load isn't a managed DLL, or one that the CLR can treat as managed.

One solution would be to use managed C++ (C++/CLI) to build a wrapper around the DLL. Another is to use PInvoke which is explained here and there's a tool for it I came across here.

You can also look in this thread: Unable to Use DLL of VB6 Into ASP.NET.

Hope one these work out for you, Asaf

Asaf R
@Asaf: thanks for sharing the views, however i am not clear on using the managed C++ wrapper, i might be stupid at asking this - How to create a C++/CLI wrapper which i can't even refer ???Also how could i use PInvoke to that.Request you to please clarify.
tush1r
@tush1r: You can either use PInvoke (directly from C#) or create a C++/CLI wrapper. There's no use in doing both. I'll try and add more on how to create such a wrapper soon.
Asaf R
Asaf R