Assembly (dll) versions and Compiled Targets

Very rarely do you have to begin interrogating one of your assemblies when it simply won’t work in a production environment…but when you do it can be supremely frustrating. Especially when the problem seems to be the fact that the third party assembly your using was compiled for 64 bit and not x86 or perhaps visa-versa.

In IIS7 you can simply configure your virtual directory to run both, but thats not what this article is about. The question is:

“How do I know the target of an assembly?” – it is not shown in the usual meta data information that you obtain from right clicking and selecting properties (i.e. where you see version numbers, etc).

Instead, you have to dig a little big. You can the Visual Studio Command Line to check an assembly:

  1. Open the Visual Studio Command Prompt
  2. Change the directory to the folder containing the dll to check.
  3. Run the corflags application as follows:   corflags YourAssemblyName.dll

Now you’ll see a bunch of output of the usual meta data regarding the assembly. However you will also see a row that says:  “32BIT” . If this value is 1 then it is 32 BIT, otherwise if its zero its compiled for Any CPU.

Thus:   1 = x86; 0 = Any CPU

Not sure of other values….please comment if you know 🙂

One Comments