Question

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."
Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top