Wednesday, March 17, 2010

Determine if an assembly is compiled for 32-bit or 64-bit

I would have expected Reflector to be able to tell me, but it seems it can't.

So here is how:
http://stackoverflow.com/questions/270531/how-to-determine-if-a-net-assembly-was-built-for-x86-or-x64

I will copy the information here for easy access:
  1. Open the Visual Studio Command Prompt (In Windows: menu Start/Programs/Microsoft Visual Studio/Visual Studio Tools/Visual Studio 2008 Command Prompt)

  2. CD to the directory containing the DLL in question

  3. Run corflags like this: corflags MyAssembly.dll

You will get output something like this:

Microsoft (R) .NET Framework CorFlags Conversion Tool.  Version  3.5.21022.8
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

The key is the "32BIT" flag as documented above: 1 = x86; 0 = Any CPU.

No comments:

Post a Comment