Skip to main content

Check the target of a .NET assembly


So you have a .NET dll and you want to know the platform it is built for. That is, you want to check whether the .NET dll was targeted for either

  • x86 (32 Bit only)
  • x64 (64 Bit only)
  • Any CPU (both 32 and 64 bit)

The easiest way to do this is to use corflags.exe which is supplied with the Microsoft Windows SDK. You can get the Windows 7 SDK from here
http://www.microsoft.com/en-us/download/details.aspx?id=8279#overview

Command Line to determine platform

1. Locate where CorFlags.exe is. Generally this would be under <ProgramFiles>\Microsoft SDKs\Windows\<version>\Bin\CorFlags.exe
2. Run CorFlags.exe <Full_Path_To_Assembly>. E.g. CorFlags.exe c:\test\test.dll
3. You will see an output like the following

S:\r862\sp1\work\pcdm\std\cms>corflags c:\test\test.dll
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  : 11
ILONLY    : 1
32BIT     : 1
Signed    : 1

To determine the platform of the dll, use the following cheat sheet

x86 : PE=PE32 and 32BIT=1

x64: PE=PE32+ and 32BIT=0

Any CPU: PE=PE32 and 32BIT=0

The signed flag indicates whether the assembly is signed or not.

If this article has helped you in some way, please feel free to leave a reply.


Comments

Popular posts from this blog

3 Benefits of getting into grassroots charities and volunteering

Volunteering at grass roots levels gives you a great satisfaction in that you know your small efforts has reached and helped someone in need. Whether it be, standing behind a counter selling some quick bites or just spending a few minutes with someone in need of company, there are so many life long traits and attributes that you pick up that you may not even realise.  The skills you pick up not only help your causes, but they also go a long way in your professional journey.  Here are 3 of the most important benefits I have come to realise about getting into grass roots charities and doing good for the people early on. 1.  Social skills Without doubt, it is one of the first skills you pick up in volunteering that goes a long way. Talking and engaging with people makes it so much easier to be able to progress in your career. It opens up new opportunities and gets you prepared for various situations. More likely than not, as a volunteer, you get the opportuni...

Running Entityframework profiler on OWIN hosted .NET Framework projects

When you get into DB level issues with your .NET framework application that is using Entity framework, you need to start to examine what is happening under the covers using tools like SQL profiler and/or Entity framework profiler . These can help you track issues and work out strategies to minimise or eliminate nasties like deadlocks. One tool that worked well for me is the entity framework profiler. To utilise this, you need to initialise this with your application code then run the diagnostic tool to be able to capture the requests going into SQL. I did have to do a bit of fiddling around as I could not get it to work out of the box with my current setup of an OWIN hosted project. I noticed the entity framework was being instantiated before the profiler and as a result threw the following exception at startup The Entity Framework was already using a DbConfiguration instance before an attempt was made to add an 'Loaded' event handler. 'Loaded' event handlers can only b...

Hello and Welcome!

Welcome to Srini's blog! This is my first blog post. Hopefully the following will give you some information on what my blogs will be about class Person { string FirstName = "Srini"; string LastName = "Vasudevan"; string Occupation = "INSERT SOME SOFTWARE ROLE HERE"; List<string> Hobbies = new List { "software development", "cricket", "community and charity work", "technology" }; } If you want to know more about my professional background, you can check out my LinkedIn profile at http://au.linkedin.com/in/sriniv85 If you want to know about the organisation I help in my spare time by doing some charitable work, please visit  http://www.sriomcare.org.au