编译为 AnyCPU 生成在 64 位机器上设置了 32BIT 标志的程序集
我在 64 位机器上的 Visual Studio 2013 中创建了一个全新的 .NET 4.5 WinForm 项目.编译后,我在 .exe 中运行 corflags 并设置了 32BIT 标志.
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
当我查看任务管理器时,它也被标记为 32 位进程.
When I take a look at Task Manager, it's also marked as a 32 bit process.
我没有添加任何可能会强制它在 32 位模式下运行的引用.我查看了项目文件,也没有发现任何可疑之处.
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.
我可以在程序集上运行 corflags/32BIT-
并且它作为 64 位进程运行得很好.
I can run corflags /32BIT-
on the assembly and it runs just fine as a 64-bit process.
什么可能导致它编译为 32 位可执行文件?
What could be causing it to compile as a 32-bit executable?
在项目Property Pages中有一个名为Build"(A)的页面.
In the project Property Pages is a page called "Build" (A).
在平台目标"字段 (B) 下,是首选 32 位"字段 (C).
Under the "Platform Target" field (B), is the "Prefer 32bit" field (C).
您可以切换它以从 corflags 中删除 32 位标志.
You can toggle that to remove the 32bit flag from the corflags.
(图片来自 VS 2015)
(Image from VS 2015)