kevin
kevin

Reputation: 14095

reference dll does not work in C#

I run a console application which will reference lib.dll .

In lib.dll, there is a class called LIB.Common.Rent(string bookName). So when I add reference lib.dll in my console application, everything is ok.

Intellisense knows everything in lib.dll.

But once I build it, it doesn't know anything about lib.dll and show the error message the type or namespace name "LIB" can not be found.

Before I build the application, I can see lib.dll info in object browser. After I built, I can't see it anymore. What is wrong ?

Thanks in advance.

Upvotes: 1

Views: 2939

Answers (2)

Michael Stum
Michael Stum

Reputation: 181064

Your Console Application is likely targeting the .net 4 Client Framework (which is a neat idea except that no one uses it, making it useless).

Right click your Project > Properties and in the Application Tab select ".net Framework 4" instead of ".net Framework 4 Client Framework". If you are targeting .net 3.5 Client Framework instead, change it to ".net Framework 3.5".

Upvotes: 6

isioutis
isioutis

Reputation: 324

Try this , On references right click LIB.dll and select properties . In the properties window check if Copy local is False , if it is change it to 'True' and try again . This way the lib.dll will be copied to the output directory

Upvotes: 0

Related Questions