Not sure this has been asked before (I could not find any). I have simple console app/ESE and have the below settings.
I'm running Windows 8, 63bit OS. And the EXE target framework .NET 4.5 However, when I compile this EXE, it still shows as a 32bit EXE.
Since this is "Any CPU", I would expect the EXE to compile as 64bit / PE32+.
Can some please help tell why this would be still 32bit?
The exe files doesn't contain any 32-bit or 64-bit code, it only contains IL code.
The JIT compiler creates machine code from the IL code, and the platform target determines what kind of machine code the JIT compiler is allowed to create.
You are misinterpreting
CorFlags
I think. Here is aCorFlags
truth table:As you can see, it will only report
PE32+
if you compile it as 64-bit and not asAny CPU
. The reason is because the header must be backward compatible. meaning if an assembly is to work in 'Any CPU', both 32 and 64 bit, then the header format must be in a format recognizable by a 32-bit operating system.PE32+
is a 64-bit only header format and if that header was applied to an assembly compiled asAny CPU
, then a 32-bit operating system would not recognize thePE32+
header format.