2

My project uses another lib project as reference.

I get this error when trying to run a project in "Relase" Mode, In "Debug" Mode it works fine.

It says that it cannot load the lib project because :

"An unhandled exception of type 'System.BadImageFormatException' occurred in mscorlib.dll

Additional information: Could not load file or assembly 'UserManagementProviders,     
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."
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
susparsy
  • 1,016
  • 5
  • 22
  • 38
  • http://stackoverflow.com/questions/5229310/system-badimageformatexception-could-not-load-file-or-assembly – Nagaraj S Jan 22 '14 at 08:58

2 Answers2

6

BadImageFormatException means 32/64 bit mismatch. Check your project configurations. The x86/x64/Any CPU settings must be messed up among Debug and Release configurations.

fejesjoco
  • 11,763
  • 3
  • 35
  • 65
0

I think this is related to the difference in 64bit and 32bit DLL builds and processes.

Try compiling to 32bit by changing project properties/Build/Platform Target.

Nagaraj S
  • 13,316
  • 6
  • 32
  • 53