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.
Could not load file or assembly in Visual Studio 2010
-
01-10-2022 - |
Domanda
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."
Soluzione
Altri suggerimenti
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
.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow