5

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...

Syspect
  • 921
  • 7
  • 22
  • 50

3 Answers3

5

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.

Lee White
  • 3,649
  • 8
  • 37
  • 62
  • okey, I opened the `.dll` file's code and the namespace is `dk.ms_it` but it's the same problem - it can't find the namespace, so I can't include it in the `using` statement – Syspect Apr 23 '13 at 12:53
  • 1
    You may not be using the right Framework. Check NDJ's answer. – Lee White Apr 23 '13 at 12:59
  • There was no problem at all with the referencing or whatever. I just restarted the Visual Studio and I was already able to see the namespace of the `.dll` file. Thanks anyway. – Syspect Apr 23 '13 at 13:00
5

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.

Milkncookiez
  • 6,817
  • 10
  • 57
  • 96
  • 1
    Actually this isn't a bug. The *Client Profile* is a subset of the .NET Framework 4 assemblies. If the referenced assembly is linked against the whole .NET Framework 4, it cannot be referenced from a project, linked against the *Client Profile*, since it could be that it uses some assemblies the *Client Profile* doesn't contain. – Carsten Apr 23 '13 at 13:30
1

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

Community
  • 1
  • 1
NDJ
  • 5,189
  • 1
  • 18
  • 27