0

I have 2 projects within my solution. In my second project I want to use some of my classes from my first project. I added a reference in my second project to my first project, however when I try and call/invoke/instantiate any object in my second project from my first project I get a:

Could not load file or assembly 'MyFirstProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

For example, if I try and create a List it will throw the error above

Any ideas? Thomas

friartuck
  • 2,954
  • 4
  • 33
  • 67
  • I think you're inverting things. If you want to use classes from the 1st project into the 2nd, the you add a reference **to the first** in the second one. – Geeky Guy Sep 11 '13 at 17:24
  • that's what I did. In my second project I added a reference to my first – friartuck Sep 11 '13 at 17:24
  • that wasn't very clear at first for me... Sorry. BTW we might need more details. Is this a solution you are deploying somewhere? Or are you getting this error in the IDE? – Geeky Guy Sep 11 '13 at 17:32
  • still in the IDE (vs2012). Both projects are being compiled for any cpu – friartuck Sep 11 '13 at 17:41
  • 1
    This is a BadImageFormatException. Lots of questions about them, type the exception name in the Search box and review the existing answers. Then tell us what's special about your case. – Hans Passant Sep 11 '13 at 18:56

0 Answers0