0

I have a dll from a class library project AppconClient. I am referring that dll in another class library project p2. I copied that dll from project AppconClient and copied to Bin\Debug folder of the project p2 and I referred the dll by clicking add reference in the project p2.

I was happy to see the namespace of AppconClient when I tried to refer the dll by using keyword at the top of Program.cs in my project p2. And I could see the classes and methods of that dll inside my project p2. But when I tried to build the project p2 I got the error saying,

The type or namespace name 'AppconClient' could not be found (are you missing a using directive or an assembly reference?)

But the same dll can be referenced in any WebApplication and it works fine also.

Can anyone tell me what could be the reason and solution for this?

4

3 Answers 3

3

There is no need to copy it manually into bin\debug. All you supposed to do is to add reference to the library from the original folder, and in the newly added reference properties set CopyLocal value to True.

Sign up to request clarification or add additional context in comments.

Comments

0

You are not supposed to copy the file to the bin\Debug folder.

The compiler will add all your referenced assemblies there.

You only need to add the reference to your original dll.

When you rebuild a project, dll files are deleted(this is what Clean does) and a fresh copy is placed there. Your original dll got deleted. So it was not there later to build the project.

If you cannot reference the original dll directly, make a copy in your project, probably a folder called Lib and put it there.

2 Comments

Guys, thanks for the response. But I found the solution myself. Change the target framework of the project p2 to ".Net Framework 4" (By default it would be pointing to ".Net Framework 4 Client Profile".
@RaghavendraHG - Please post it as answer and accept it(By clicking on the Right mark) after sufficient amount of time.
0

Dont Copy. If you copy this may happen because when you are publishing your web site the Copied DLL may be missing.

Right way to do is Add Reference and browse. VS will automatically do it for you.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.