First, observe the drop-down list of target components on different platforms through the experiment. In Visual Studio, adjust PlatformTarget to Any CPU in sequence, x86and x64, and compile eventpingpongany.exe, EventPingPongX86.exe, and EventPingPongX64.exe.
Use the corflags EventPingPong *. exe method to check related properties. The result is as follows:
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 head: 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 head: 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 head: 2.5
PE: PE32 +
CorFlags: 1
ILONLY: 1
32BIT: 0
Signed: 0
To change the target platform of the program compiled into Any CPU to x86, run the following command:
CorFlags/32BIT + EventPingPongAny.exe
Change the parameter to/32BIT, and then you can restore it back to Any CPU. Because the programs on the pure x64 target platform are different from those on PE (for PE32 +, different from Any CPU and x86), CorFlags cannot be switched directly and must be re-compiled.