Pages

Sunday, April 16, 2017

How to determine if a dll is built for 32-bit, 64bit or Any CPU

CorFlags.exe is part of the .NET Framework SDK. I have the development tools on my machine, and the simplest way for me determine whether a DLL is 32-bit only is to:

  • Open the Visual Studio Command Prompt (In Windows: menu Start/Programs/Microsoft Visual Studio/Visual Studio Tools/Visual Studio 2008 Command Prompt)
  • CD to the directory containing the DLL in question
  • 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        : PE32CorFlags  : 3
ILONLY    : 1
32BIT     : 1
Signed    : 0
The key is the "32BIT" flag as documented above: 1 = x86; 0 = Any CPU.
For x64 only the output would be (plus after 32): PE: PE32+

No comments:

Post a Comment