I have seen posts regarding this error message many time but none of them gives the answer to the problem. I will try to explain what happens very simple. I have 64 bit Windows 7, Visual Studio 2010. I created an empty solution.
I added existing Class Library Project to the solution, lets call it ClassLibrary1.
I added a new Console application to the solution, lets call it ConsoleApplication1.
In ConsoleApplication1 I clicked <Add Reference> and added a reference
ClassLibrary1 project.
Now... the problem - I cannot use code in ClassLibrary1.
When, in ConsoleApplication1 I type:
ClassLibrary1.Class1 c1 = new ClassLibrary1.Class1();
it is not working, namespace is not recognized and code in ClassLibrary1 is inaccessible. Same happens when I try to add ausing directive for ClassLibrary1 namespace.
I simplified the code to show the problem, but that is what happens.
Details: ClassLibrary1 was created in VS2008 and target framework is set to .NET 3.5.ConsoleApplication1, I just created. I thought this problem comes from the difference in target framework, which is 4.0 inConsoleApplication1. So, I changed target framework for ConsoleApplication1 to .NET 3.5, same as ClassLibrary1.
But it didn't solve the problem. I have spent many days trying to figure out what the problem is, but unsuccessfully, since everything seems absolutely normal to me. I broke my brain :) Strangely, such behavior is random - sometime it works fine and sees all the references and namespaces, but sometimes it throws that weird exception, even if no change was done to the code.
I anyone has ANY ideas what is wrong here I would really appreciate any advice. Cause I am stuck here :(