tush1r
tush1r

Reputation: 19583

Calling a DLL from C# (VS2008)

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

Upvotes: 2

Views: 454

Answers (1)

Asaf R
Asaf R

Reputation: 6978

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

Upvotes: 3

Related Questions