So I have found a workaround.
The following command should be called after Mono.Cecil transform:
   CorFlags.exe /UpgradeCLRHeader HelloWorld.exe

After that HelloWorld.exe successfully starts in 64-bit mode.

As a conclusion I must admit that CPU flags are ok after Mono.Cecil
transform. CLR header version is the main troublemaker. Please take a
look at the following:

Before Mono.Cecil transform:
Version   : v2.0.50727
CLR Header: 2.5
PE        : PE32
CorFlags  : 9
ILONLY    : 1
32BIT     : 0
Signed    : 0

After Mono.Cecil transform:
Version   : v2.0.50727
CLR Header: 2.0
PE        : PE32
CorFlags  : 9
ILONLY    : 1
32BIT     : 0
Signed    : 0

So as you can see Mono.Cecil downgrades CLR header version from 2.5 to
2.0. From the internet sources (http://blogs.msdn.com/gauravseth/
archive/2006/03/07/545104.aspx and others) I have found that 2.0
version of CLR header was used in .NET 1.0/1.1 only but not in .NET
2.0 and higher. Hence such a strange behavior on 64-bit systems.

--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to