Friday, September 28, 2012

.NET Assembly 32bit or 64bit, Signed or Unsigned?

Sometimes before starting debugging, we need to know whether the .NET assembly is 32bit or 64bit. One simple way of doing it is to use a .NET tool called CorFlags.EXE. In order to use it, open [Visual Studio Command Prompt (2010)] and run CorFlags.exe with an assembly filename. This will show some assembly information as you see below.


To see 32bit, 64bit or any CPU, you check PE and 32BIT lines.

PE: PE32 / 32BIT: 1 = x86
PE: PE32 / 32BIT: 0 = Any CPU
PE: PE32+/ 32BIT: 0 = x64

You can also check whether the assembly is signed or not. Signed at the last line indicates whether it's signed. Signed : 0 in above example means that the assembly is not signed by key and so it's not the strongly named assembly; cannot be put into the GAC.

CorFlags.EXE tool not only shows assembly information but also can be used to change assembly header. For example, if you want to change 32bit to Any CPU, you can run:

C> CorFlags MyApp.exe /32bit-

No comments:

Post a Comment