title: System.BadImageFormatException when target framework is 4.0
body: <p>I have a run time exception after changing Target Framework to .net framework 4:
  A first chance exception of type 'System.BadImageFormatException' occurred in </p>
  
  <p>When building with target framework 3.5, everything works fine.</p>
  
  <p>The platform i am building to is x86 (i found out that building to x64 night cause the problem).</p>
  
  <p>What can be the problem?</p>