Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't use referenced DLL in C#

Tags:

c#

dll

I have added a reference to an external of my project and solution .dll file, I can see it under the References node in the Solution Explorer window, but it can't find it when I try to use it in the statement using dllfilename, so I basically can't use the library. When I go to the Object Browser - I find the Namespace of the project and it's classes/methods but I can't see the referenced library or at least its namespace or whatever...

like image 587
Syspect Avatar asked Apr 23 '13 12:04

Syspect


3 Answers

There is a bug in VS2010. The solution is easy: Project -> Properties -> Application tab -> change Target Framework to ".NET Framework 4" instead of the Client Profile that is selected by default.

like image 193
Milkncookiez Avatar answered Oct 01 '22 13:10

Milkncookiez


You don't need to use using dllfilename. The correct usage is using NamespaceThatIsAccessibleFromDll;. Once you do that, you can use the public classes that appear in this namespace.

like image 30
Lee White Avatar answered Oct 01 '22 13:10

Lee White


Try project, properties; in the application tab under target framework if you have .NET Framework 4 (Client Profile) (or 4.5 Client Profile) then change it to the appropriate version without the client profile. This has caught me out a few times - and I'm not alone -

Can't see namespace

like image 35
NDJ Avatar answered Oct 01 '22 12:10

NDJ