How do I determine if a .NET application is 32 or 64 bit?

Viewed 36039

I have a .NET application that was supposed to be compiled as a 32-bit only application. I suspect my build server isn't actually doing it.

How do I determine if a .NET application is actually set to run in 32-bit mode?

8 Answers

I was searching for the same information and I found that since Windows 8.1, there is no more asterisk.

You have a Task Manager details column named "Platform". Its content is "32 bits" or "64 bits".

This is an update of the old accepted answer from 2010:

  1. Open Visual Studio.
  2. Go to "Tools" --> "Command Line" --> "Developer Command Prompt".
  3. Run corflags <path/to/your/exe_or_dll_file>.

The output of corflags has changed and now looks like this:

Version   : v4.0.30319
CLR Header: 2.5
PE        : PE32
CorFlags  : 0x3
ILONLY    : 1
32BITREQ  : 1
32BITPREF : 0
Signed    : 0

The line to look for is 32BITREQ, which means "32-bit required". It is set to 1 if you build with Any CPU but also link against a 32-bit native DLL. This means your DLL or EXE is effectively "32-bit (only)", e.g., it cannot run in a 64-bit IIS application pool.

If a DLL was built with platform x64 rather than Any CPU, then the output may look like this:

Version   : v4.0.30319
CLR Header: 2.5
PE        : PE32+
CorFlags  : 0x1
ILONLY    : 1
32BITREQ  : 0
32BITPREF : 0
Signed    : 0

The string PE+ indicates that the DLL was built for x64. With x86 or Any CPU, it is PE32.

Related