How do I tell if my application is running as a 32-bit or 64-bit application?
How do I tell if my application (compiled in Visual Studio 2008 as Any CPU ) is running as a 32-bit or 64-bit application? Perica Zivkovic if (IntPtr.Size == 8) { // 64 bit machine } else if (IntPtr.Size == 4) { // 32 bit machine } Sam If you're using .NET 4.0, it's a one-liner for the current process: Environment.Is64BitProcess Reference: Environment.Is64BitProcess Property (MSDN) I found this code from Martijn Boven that does the trick: public static bool Is64BitMode() { return System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntPtr)) == 8; } Scott Ge This code sample from Microsoft All