I work on a 64 bit machine but frequently deploy to 32 bit machines. The code I work on though has native hooks so I always need to deploy assembly entry points at 32 bit. This means I am usually paranoid about the build configuration. However, sometimes things slip up and a 64 bit dll gets sent out or an entrypoint is built with
ANY CPU set. Usually this is caught on our continuous build server with some cryptic reason for a unit test that should be working is actually failing.
When this happens, what you’ll get is a message like this:
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Some.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. at Test.Program.Run(Args args, Boolean fastStart) at Test.ProgramMain(String args) in Program.cs:line 36
The first thing I do here is to try and … Read more