The bitness is determined by setting the Target Platform to EXE. The mechanism does not guarantee that an EXE that references a 32-bit assembly will be forced to run in 32-bit mode. The assembly simply does not load using the BadImageFormatException.
If your program has a dependency on such a DLL, you must force the Target platform in your EXE project from AnyCPU to x86.
source share