Geeks With Blogs
Hannes Pavelka It isn't rocket science. Well, unless of course you're NASA

Let’s assume you have all (most) of the framework versions installed on your machine.
How can you determine which application uses which framework version ?

Reminder: There is plenty of information about how to determine which framework version is installed.
The question at hand, is about which framework version does an application actually use !
Microsoft published an kb about  :
How to determine which versions of the .NET Framework are installed and whether service packs have been applied
For your information, here is a full list of version numbers:

However, most people just differentiate between v. 1.0/1.1 (what they mean is 1.1.4322.2032) and v 2.0 (which is 2.0.50727.42).


Now back to the original question. How can you determine what framework version an application uses ?

There is an tool called clrver.exe which is shipped with the SDK for .Net 2.0 , you can find the tool under C:\Programme\Microsoft Visual Studio 8\SDK\v2.0\Bin

If you use the clrver.exe tool without arguments you get the following output:
C:\Programme\Microsoft Visual Studio 8\VC>clrver.exe
Versions installed on the machine:
v2.0.50727
You can use all / <pid> argument to get more detailed information.
-all   - Displays all processes on the machine using the CLR.
<PID> - Displays the version of the CLR used by the specified process.

Thus you can get detail information about the running processes.

3920    devenv.exe              v2.0.50727
2084    WebDev.WebServer.EXE    v2.0.50727
2944    Obab.UI.ProfessorenClientCab.vshost.exe v2.0.50727

Unfortunatley, you can only get the information from running applications. There is no way to let clrver.exe determine the required/used framework version from the application file itself.

Over at Devfish , you find an interesting arcticle  about the above topic and what is more important, you can even download a simple tool to determine the version information directly from a file.You pass that tool a filename and it outputs the Version information and what version of the CLR runtime the file requires. The source code for that tool can be found here.

I wonder why clrver.exe does not supply this functionality out-of-the-box ?

Posted on Saturday, December 30, 2006 12:19 AM .NET | Back to top


Comments on this post: How to determine which clr version an assembly or executable is using

# re: How to determine which clr version an assembly or executable is using
Requesting Gravatar...
Does anyone know if a way to scan an entire drive and see which exe's use .net 1.0 or .net 2.0?
Left by bob on Jun 28, 2007 4:00 AM

# re: How to determine which clr version an assembly or executable is using
Requesting Gravatar...
This can also be done by using corflags.exe (supplied with vs2005)
Left by M on May 22, 2008 8:23 PM

# re: How to determine which clr version an assembly or executable is using
Requesting Gravatar...
This can also be done by using corflags.exe (supplied with vs2005)
Left by M on May 22, 2008 8:24 PM

# re: How to determine which clr version an assembly or executable is using
Requesting Gravatar...
One of the reasons why I think it doesn't make sense to show which version of clr a file uses until you run it is because, consider an example of a managed com component that is compiled against v2 and called from a process or a host that is running against v4. In this case, it can be found out that the v4 app requires clr4 but until it executes and loads v2 managed com compoenent, v4 itself has no idea about it. makes sense?
Left by Sarang on Aug 06, 2009 1:46 AM

# re: How to determine which clr version an assembly or executable is using
Requesting Gravatar...
Sarang: In most cases, if you find out the v4 app requires clr4, you know you're going to need clr4 and be right 99.99(999?)% of the time. The mentioned utility, as well as M's suggested corflags.exe use both fit the bill for what I want, and probably will work for most peoples needs as well, being as there's little need in the first place and those of us looking for the utility pretty much know what we want. ;) Thanks for bringing it up though, it's certainly worth keeping in mind, just in case.
Left by A on Apr 29, 2010 6:48 PM

Your comment:
 (will show your gravatar)


Copyright © Hannes Pavelka | Powered by: GeeksWithBlogs.net