Could not load type - TypeLoadException problem

I have two projects in one solution and I reference project 2 from project 1.

The code compiles, but when I try to run it, I get the following unhandled TypeLoadException:

System.TypeLoadException was unhandled
Message: Could not load type 'MyNamespace.Class2' from assembly 'Class1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

Any ideas what could be causing this and how to solve it?

Thanks!
gromulAsked:
Who is Participating?
 
WinterMuteUKConnect With a Mentor Commented:
Hey Gromul,

one thing to try is to delete all the dll's/exe's in the bin directories (You could just delete the Bin directories, or in VS2005 rightclick on the solution and say - Clean Solution).

Then try compiling and running.

I've had this issue when I had an older version of a dll in the wrong place, generally when I renamed a dll for example.

Cheers
Wint
0
 
AgariciConnect With a Mentor Commented:
could you please provide a litle more info?
such as: what is the code that try to load the class2?
how is class2 defined...

A.
0
 
gromulAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.