CorFlags.exe check.NET program platform target of Platform Target tools

  • 2020-05-26 08:18:28
  • OfStack

Experiment with the drop-down list of target components for different platforms. In Visual Studio, PlatformTarget is adjusted to Any CPU, x86 and x64, which are compiled into EventPingPongAny.exe, EventPingPongX86.exe, EventPingPongX64.exe3 assemblies, respectively.

corflags EventPingPong*.exe method is used to check the relevant properties, and the results are 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 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

To change the program target platform compiled to Any CPU to qualify x86, use the following instructions:

CorFlags /32BIT+ EventPingPongAny.exe

Change the parameter to /32BIT- and you can revert back to Any CPU. As for the pure x64 target platform program, because PE is different (PE32+, different from Any CPU, x86), CorFlags cannot be switched directly, so it must be recompiled.


Related articles: