简体   繁体   中英

Visual Studio 2012 C# - Importing a DLL

I am actually trying to use a DLL on a C# project. The problem is, whenever I try to import it in my project by adding it as a reference, I get this error message :

A reference to "C:\\FilePath\\LnkEMP.dll" could not be added.
Check that the file is an assembly or a valid COM component

The library is "LnkEMP.dll", used for a program called Expert/M Plus. I need this library to interract with this program.
I think that this DLL is made in C++, which could be one of the reason that my C# project can't load it.
I tried to make a C++ Library and importing it, but this time I had another error message :

A reference to "C:\\FilePath\\LnkEMP.dll" could not be added,
because it is not an assembly .NET, or not a registered ActiveX control

Do you have any idea of what should I do to get it work ?

You can fall back on dynamic loading of dll using Win32 api calls. There should be lots of examples of dynamical loading/calling of external dll. Hopefully your dll comes with doc on how to use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM