CorFlags说我的.NET程序以64位运行,而DumpBin则是32位 [英] CorFlags says my .NET-Program runs as 64bit while DumpBin means it is 32bit

查看:175
本文介绍了CorFlags说我的.NET程序以64位运行,而DumpBin则是32位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个项目,并将其编译为任何CPU 。在x64-Windows上。由于无法从代码中引用该程序集,因此我检查了运行时和目标平台:

I created a project and compiled it as Any CPU. on x64-Windows. As I have trouble to reference that assembly from my code I checked the runtime and the target-plattform:

如您所见,在x64-OS(作为我的操作系统)上运行时,目标平台是x64。我还检查了 DumpBin

As you can see the target plattform is x64 when running on an x64-OS (as mine). I checked DumpBin also:

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
             14C machine (x86)
               3 number of sections
        57A49000 time date stamp Fri Aug 05 15:09:20 2016
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
             102 characteristics
                   Executable
                   32 bit word machine

但是当我运行 CorFlags 时, me x64作为该程序集的平台:

However when I run CorFlags it´s giving me x64 as plattform for that assembly:

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

据我了解,当我选择任何CPU 作为目标平台时,操作系统将选择如何执行程序集。在64位系统上,它将以64位运行,在32位OS上则分别为32位。

As far as I understand when I chose Any CPU as target platform the OS will chose how to execute the assembly. On an 64bit system it´ll run in 64bit, on 32bit-OS as 32bit respectivly.

所以我的问题是:我实际上定位的是哪个版本?是32位还是64位?

So my question is: what version am I actually targetting? 32 or 64bit?

推荐答案

那是完全正常的。 AnyCPU表示它可以在任何cpu上运行,因此标头中的 machine 字段不相关。必须选择某物,它只需选择x86。使其与Win98和Win2k等古代Windows版本兼容。

That's entirely normal. AnyCPU means that it can run on any cpu so the machine field in the header cannot be relevant. Having to pick something, it just picks x86. Keeps it compatible with ancient Windows versions like Win98 and Win2k.

特殊英雄发生在64位操作系统上,操作系统加载程序需要帮助才能从32位可执行文件创建64位进程,这需要修补内部装载机结构。 mscoree.dll loader-shim按照链接文章中的描述完成该工作。

The special heroics happen on a 64-bit operating system, the OS loader needs help to creating a 64-bit process from a 32-bit executable, that requires patching internal loader structures. The mscoree.dll "loader-shim" gets that job done as described in the linked post.

因此,您定位到任何特定版本。确实是AnyCPU。

So you do not target any particular version. It truly is AnyCPU.

这篇关于CorFlags说我的.NET程序以64位运行,而DumpBin则是32位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆