0

I've created a brand new .NET 4.5 WinForm project in Visual Studio 2013 on a 64-bit machine. After compiling, I run corflags in the .exe and the 32BIT flag is set.

Version   : v4.0.30319
CLR Header: 2.5
PE        : PE32
CorFlags  : 131075
ILONLY    : 1
32BIT     : 1
Signed    : 0

When I take a look at Task Manager, it's also marked as a 32 bit process.

I didn't add any references that would maybe force it to run in 32-bit mode. I took a look at the project file and didn't spot anything suspicious either.

I can run corflags /32BIT- on the assembly and it runs just fine as a 64-bit process.

What could be causing it to compile as a 32-bit executable?

Jeff B
  • 8,572
  • 17
  • 61
  • 140
  • 3
    Do you have the `Prefer32Bit` MSBuild property set somewhere in a `.csproj` file? – Martin Costello May 31 '16 at 16:34
  • 1
    In the project properties there's a tab called "Build". Under the "Platform target" field is the "Prefer 32-bit" field. Could that be what you need to change? –  May 31 '16 at 16:34
  • @AndyJ I didn't know that property existed. Turning that off and rebuilding fixes the issue for me. – Jeff B May 31 '16 at 16:36

1 Answers1

2

In the project Property Pages is a page called "Build" (A).

Under the "Platform Target" field (B), is the "Prefer 32bit" field (C).

You can toggle that to remove the 32bit flag from the corflags.

Prefer 32bit (Image from VS 2015)