An attempt was made to load a program with an incorrect format
问题 I am using C# loading C++ dll, and got this error: "An unhandled exception of type 'System.BadImageFormatException' occurred in MyApp.exe" "Additional information: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8057000B) I could not figure out why. The C++ dll was generated using vs2012 wizard, win32 application, dll with pre-head. It is built with x64 option. Here is the code: // MyNativeDLL.cpp : Defines the exported functions for the DLL