ShrimpBoy said:
I'm working with .NET 2005 and Framework 2.0
I'm trying to find if the program currently run on a x86 machine or a x64
machine.
Is there a way to do that?
If you just need to know whether your *process* is running as 32-bit or
64-bit, you can check IntPtr.Size. This is independent of platform or
processor and it's usually what processes need, if they need to know anything.
..NET offers no way of determining the specific architecture you're running
on, which is probably for the best -- for one thing, the framework is not
restricted to running on either x86 or x64, so making these assumptions can
be dangerous and/or unnecessarily restrictive.
You can do it non-portably with a combination of Environment.OSVersion and
the unmanaged GetNativeSystemInfo() function, but the best you might be able
to get out of this is that you're running on an unknown architecture which
*might* be x86 or x64 or something else altogether (if you're running on
Linux, for example). Make sure you know what you need first.