先通過實驗觀察不同平台目標組件的下拉列表。在Visual Studio中依序調整PlatformTarget為Any CPU, x86及x64,分別編譯成EventPingPongAny.exe, EventPingPongX86.exe, EventPingPongX64.exe三個程序集。
再使用corflags EventPingPong*.exe的方法檢查相關屬性,得到結果如下:
H:\Lab\EventPingPong\bin>corflags EventPingPongAny.exe
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Version : v2.0.50727
CLR Header: 2.5
PE : PE32
CorFlags : 1
ILONLY : 1
32BIT : 0
Signed : 0
H:\Lab\EventPingPong\bin>corflags EventPingPongx86.exe
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Version : v2.0.50727
CLR Header: 2.5
PE : PE32
CorFlags : 3
ILONLY : 1
32BIT : 1
Signed : 0
H:\Lab\EventPingPong\bin>corflags EventPingPongx64.exe
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Version : v2.0.50727
CLR Header: 2.5
PE : PE32+
CorFlags : 1
ILONLY : 1
32BIT : 0
Signed : 0
若要將編譯成Any CPU的程序目標平台改為限定x86,可使用以下指令:
CorFlags /32BIT+ EventPingPongAny.exe
將參數改為/32BIT-則可以再還原回Any CPU。至於純x64目標平台的程序由於PE不同(為PE32+,與Any CPU, x86不同),故無法直接使用CorFlags切換,必須重新編譯。