Okay, here's my setup.
I have a c# app working perfectly on all 32-bit Windows XP-Vista-7 machine. I already have a verisign PFX to support the ClickOnce deployment and is using Atalasoft DotTwain 8.0 as the 3rd party scanner helper.
When I publish my application, I choose "Any CPU" as the Platform target. When I try to make it run on a Windows 7 64-bit Home Premium, my application crashes after the installation.
I tried re-publishing the work on a specific x64 platform but still failed.
Any ideas on what i'm doing wrong here? thanks so much~!
Choose 'x86' and I'll bet it will work;
You most likely have an 'x86' (32-bit) reference in your project, for example DotTwain. 'Any CPU' means that the .NET framework will run it as 'x64' because you've told it anything is OK. Then it tries to load a reference, finds it's 32-bit and gives a 'BadImageFormatException' (usually).
And so, you'd need a version of DotTwain that's not been 'ngen-ed', has a CPU reference of 'Any' too, or release a separate 64-bit version where all of your references are definitely not set to 'x86' (you'd want 'any' or 'x64').
(Experience this problem all the time; have several apps out there that run on 32-bit, 64-bit, and use DotTwain and other Atalasoft components)
Hope that helps!
来源:https://stackoverflow.com/questions/3287492/running-a-scanning-app-on-a-64-bit-machine-via-clickonce