BadImageFormatException
I have been working on a multithreaded application and I have been running it on my desktop machine as I am building it out. Everything seems to be running smoothly so I decide that it is time to move it over to my dual quad core zeon box to see how well it will do in that scenario. At this point I am just gathering metrics. I create the installer and install it on the box and as soon as I runn the app I get the following error “BadImageFormat Exception”. Not quite sure whats going on, I surmised that it had something to do with the fact that my desktop is x86 and my servers are x64, Now I know I compiled it using “Any CPU”. Should work I would think. Well I was wrong. In order for it to run on the x64 box, I needed to actually compile it using “x86″ cpu selection.The issue was not so much the app itself as it was the 3rd party dll that I had referenced. If I removed it then all went well to a point (no work was really done). So if you run into this issue try out this solution and see if it helps.
-paul
Yup, when Vista 64 came out I discovered this. I run Vista 64 of my desktop and work with a lot of legacy c++ code. I had to learn this pretty quickly about a year ago. It would have been nice to have this post back then, it would have saved me some time!
Comment by danrigsby — February 28, 2008 @ 11:22 pm