tags:

views:

69

answers:

2

This is a console application that I am developing using VS2010 in C#. II got a dll from one of my colleague that I need to use. I added the dll as the reference , added the required name space. Added code to create an instance of the object and used a method from the class. When I finished the code there are no errors reported by VS. When I compiled, I got an error stating 'The Type or namespace name myname could not be found'.

After I got the error, I removed the dll. I removed the name space. Now my code has red underline over where I first reference the class. I hover over it and using intellisense I added the namespace. I used object explorer to make sure it is there. Now I rebuild the solution and I got the same error. I went to object explorer and the dll reference is gone. But when I look at the reference I see the dll still there. I double click to take it to object explorer and the object definition is not there. It is really weird. This is happening only to this dll I got.

What am I doing wrong here?

* Found the problem. It seems the DLL my friend was build on framework 3.5 with some dependencies. I changed the frame work to 3.5 and now it build properly. Thanks,

+1  A: 

When you add the reference, you may want to make sure that CopyLocal is set to True in the properties.

Joel Etherton
+1  A: 

Whenever I get this problem, it is almost always because I am targeting the wrong framework.

Ryan Bennett