user990635
user990635

Reputation: 4249

using dll file in c#

I included the bin folder in my MVC project (TestProj), and added my own dll file (testDll.dll). I am trying to access my dll file by writing:

using TestProj.testDll;

but it doesn't recognize my testDll file.

Upvotes: 0

Views: 2511

Answers (5)

Siva Charan
Siva Charan

Reputation: 18064

Insert your project (testDll.dll) into references and try.

Upvotes: 0

Otiel
Otiel

Reputation: 18743

To add your testDll.dll file as a reference:

  • Right click on References under your project
  • Click Add reference
  • Click Browse and look for your testDll.dll file

Add reference

Then, add the using XXX; (where XXX is a namespace present in your library) line in the files where you need to access your library members.

If you later want to update your library, just replace the testDll.dll file by the more recent.

Upvotes: 2

ojlovecd
ojlovecd

Reputation: 4892

Does your dll appear in your bin folder in the solution explorer window? Btw, you can only import the namespaces but not your dll with the using statement.

Upvotes: 0

Chris Fulstow
Chris Fulstow

Reputation: 41882

You need to add a reference to your assembly DLL. Right-click your project's References in Soluction Explorer, select Add Reference, click the Browse tab, then select your library.

Upvotes: 1

Serge Wautier
Serge Wautier

Reputation: 21878

using Blah;

Blah is a namespace, not a DLL. It's just a convenience to save you the typing of the namespace when referencing the functions in the DLL.

What you want is to add the DLLs in the references of the project. Right-click References under your project (in the Project View) and choose Add Reference.

Upvotes: 1

Related Questions