Calling DLL from C # (VS2008)

I have a DLL (Test.dll) that contains some Excel Addin, I don't know what version it builds (maybe with VB6, but I'm not sure).

When I tried to reference this DLL in VS2008 I get the message

A reference to the name <DLL> could not be added. Verify that the file is accessible and that it is a valid assembly or COM component.

If anyone can help me on this that would be great.

Any help is appreciated.

Thanks and Regards, Tushar

+2


source to share


1 answer


It seems to me that the DLL you are trying to load is not a managed DLL or one that the CLR can handle as managed.

One solution would be to use managed C ++ (C ++ / CLI) to create a wrapper around the DLL. Another is to use PInvoke, which is explained here and there is a tool out there for that I stumbled upon here .



You can also have a look in this thread: Can't Use VB6 DLL in ASP.NET .

Hope this helps you Asaph

+3


source







All Articles