This entry has been published on 2013-05-21 and may be out of date.
Last Updated on 2013-05-21.
Scenario:
Basically, most developers publish their projects separately for x86 and x64 platforms. This can lead to problems if the user installs the x86 version on an x64 OS; the software might not work because of driver problems, wrong 3rd party DLL references with different architectures, etc.
Solution:
Using .Net Framework 4 and upwards, there are 2 simple Environment properties for this case:
bool myProcessRunsInX64Mode = Environment.Is64BitProcess;
bool isX64OS = Environment.Is64BitOperatingSystem;