Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Assembly CLR Version

0.00/5 (No votes)
11 Jan 2012 2  
A way to quickly find the CLR version of a .NET assembly from the command line
I've been searching for a way to quickly find the CLR version of a .NET assembly from the command line.

Found references about ILDADM, DUMPBIN, assembly reflection methods, and so on. But still, those tools dump a lot of information and could directly find what I need, at least from a command line.

Here's what I found.

Using some gnuutil[^] commands (I love these tools on Windows environment), I extracted exactly the CLR version like this:

Command line
ildasm /header /text [ASSEMBLY_PATH] | grep -A 7 "Metadata Header" | tail -n 1

Result
//              'v2.0.50727' Version String


The ildasm command will dump a lot of information and the header will dump even further information.
Grep will search the Metadata Header text and will display the following 7 lines.
Tail will only retrieve the last line from the previous 7 lines.

Hope this will help you on catching old assemblies.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here