Add reference to dll


N

ndq

Adding a .dll file as a reference in C# application shows error:

"A reference to the "dll" could not be added. Make sure that the file is
accessible and that it is a valid assembly or COM component."

Does this mean that for add-reference to work, the dll has to be in managed
code or COM dll in unmanaged code?

How to tell if a DLL is in managed or unmanaged code?
 
Ad

Advertisements

A

Alberto Poblacion

ndq said:
Adding a .dll file as a reference in C# application shows error:

"A reference to the "dll" could not be added. Make sure that the file is
accessible and that it is a valid assembly or COM component."

Does this mean that for add-reference to work, the dll has to be in
managed
code or COM dll in unmanaged code?

Yes, it does. You can use a non-managed, non-COM DLL by means of
Platform Invoke (using the [DllImport] attribute), but it can't be added as
a Reference.
How to tell if a DLL is in managed or unmanaged code?

You can try to open it with ILDASM.EXE. It will give you an error
message if it is not managed code, otherwise it will show you the contents
of the DLL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top