32-bit .NET apps on x64
I've just wiped my old Windows Mobile phone and given it a fresh install. Along with the phone came a copy of CoPilot 7. Handy Sat Nav program, which I often use (even just for the speed camera alerts).
But this is where things went wrong. I installed CoPilot Central (version 1), which is the PC bit of the software required to load the maps etc onto the device. And it completely failed to run. No amount of Windows troubleshooting compatibility helped here.
A quick nose shows that it's a .NET application (tell tell signs of manifests and config files). So trawl through my Windows log to try and find the error. System.BadImageFormatException
Ah yes, well this is going to be done to my computer being 64-bit, and this software being old. Although this shouldn't matter in .NET as it's not platform specific.
The reason for this is down to developers not setting the flags correctly when compiling. Lucky for us Microsoft have a too called CorFlags.exe that allows us to fix this without having to compile the app ourselves.
This is available as a part of the .NET SDK.
Simple run the following command:
corflags "CoPilot Central.exe" /32bit+
Job done, the app should now launch as normal.