.NET - How to determine the installed Framework version

(3 different techniques)

Is it CLR version or Framework version? What's the difference?


The CLR is the .NET Runtime.
The Framework is the .NET Class Library.


CLR version numbers are of the form:

    1.0 | 1.1 | 2.0 | 4.0

Framework version numbers are of the form:

    1.0 | 1.1 | 2.0 | 3.0 | 3.5 | 4 | 4.5 | 4.5.1 | 4.5.2 | 4.6 | 4.6.1 | 4.6.2 | 4.7


Typically, there is a 1-1 correspondence between a Framework version and a CLR version. E.g. Framework 4.x, is usually built on CLR 4.x.
There are exceptions. Framework versions 3.0 and 3.5 were built on CLR version 2.0.

1
You can query the .NET Framework install directory:
  dir  /b  %windir%\Microsoft.NET\Framework\v*
  
  v1.0.3705
  v1.1.4322
  v2.0.50727
  v3.0
  v3.5
  v4.0.30319
  
2
You can use WMI (Windows Management Instrumentation):
  C:\Users\Richard>wmic products get description | findstr /i /r /c:"NET Framework [0-9]" | sort
  
  Microsoft .NET Framework 4 Multi-Targeting Pack
  Microsoft .NET Framework 4.5 Multi-Targeting Pack
  Microsoft .NET Framework 4.5 SDK
  Microsoft .NET Framework 4.5.1 Multi-Targeting Pack
  Microsoft .NET Framework 4.5.1 Multi-Targeting Pack (ENU)
  Microsoft .NET Framework 4.5.1 RC Multi-Targeting Pack for Windows Store Apps
  Microsoft .NET Framework 4.5.1 RC Multi-Targeting Pack for Windows Store Apps (ENU)
  Microsoft .NET Framework 4.5.1 SDK
  Microsoft .NET Framework 4.5.2 Multi-Targeting Pack
  Microsoft .NET Framework 4.5.2 Multi-Targeting Pack (ENU)
  Microsoft .NET Framework 4.6 SDK
  Microsoft .NET Framework 4.6 Targeting Pack
  Microsoft .NET Framework 4.6 Targeting Pack (ENU)
  Microsoft .NET Framework 4.6.1 SDK
  Microsoft .NET Framework 4.6.1 Targeting Pack
  Microsoft .NET Framework 4.6.1 Targeting Pack (ENU)
  Microsoft .NET Framework 4.6.2 SDK
  Microsoft .NET Framework 4.6.2 Targeting Pack
  Microsoft .NET Framework 4.7 SDK
  Microsoft .NET Framework 4.7 Targeting Pack
  
3
You can query the registry:
  reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP"
  
  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\CDF
  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727
  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0
  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5
  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4
  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0
  

Ads by Google

Ask a question, send a comment, or report a problem - click here to contact me.

© Richard McGrath