Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone!

How can I target my deployment for 32-bit or 64-bit computers? My program works just fine on a 64 bit computer, but when I try to run it on a 32-bit computer, it fails on startup after double clicking the exe icon. I can't tell where the root is, whether it be with Visual Studio or InstallShield.
Posted
Comments
Sergey Alexandrovich Kryukov 31-Oct-12 20:06pm    
There can be different reasons for that. Did you try to target it to "AnyCPU", which is the most reasonable target in most cases?
--SA

1 solution

Your application is likely built as a 64 bit application in which case it will only run on a 64 bit system. If you need it to run in both 32 and 64 bit, then you'll have to target your solution in Visual Studio to 32 bit and the compiled application should work in both environments provided no dependencies exist that are only 64 bit.
 
Share this answer
 
Comments
joshrduncan2012 31-Oct-12 17:11pm    
How can I change it to 32 bit? Is that in Config Manager? Also, how do I know whether or not the sql server compact dlls are 32 bit or 64 bit?
fjdiewornncalwe 31-Oct-12 17:17pm    
Project Properties->Build Tab-> Platform Target: x86
If your solution builds and runs properly after changing the target, then you're ok on the 32/64 bit stuff. My personal preference is to select "Any CPU" in cases like this.
Sergey Alexandrovich Kryukov 31-Oct-12 20:12pm    
Marcus, it should not be just your personal preference, as this is the only reasonable target for almost all cases. You should have mentioned this first in the answer itself. Concrete CPU instruction-set architectures should be set only for special cases, such as the cases of P/Invoked unmanaged code by one of assembly.
It's also important to know that it's absolutely impossible to mix two different target architectures in one process. And the resulting architecture is mandated ether by the entry assembly, or by physical CPU in case of "AnyCPU". And also, both 64-bits are compatible with 32-bit executed via WoW64, but not with each other.
(I voted 4 this time.)
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900