How to: Determine which .NET Framework versions are installed

Users tin can install and run multiple versions of .Net Framework on their computers. When you lot develop or deploy your app, you might need to know which .NET Framework versions are installed on the user'south calculator. The registry contains a listing of the versions of .Net Framework installed on the calculator.

.NET Framework consists of two main components, which are versioned separately:

  • A set up of assemblies, which are collections of types and resources that provide the functionality for your apps. .Internet Framework and the assemblies share the aforementioned version number. For example, .Internet Framework versions include 4.5, 4.half dozen.1, and four.7.ii.

  • The common language runtime (CLR), which manages and executes your app'southward lawmaking. A single CLR version typically supports multiple .NET Framework versions. For example, CLR version 4.0.30319.xxxxx where xxxxx is less than 42000, supports .Cyberspace Framework versions iv through four.5.ii. CLR version greater than or equal to 4.0.30319.42000 supports .Cyberspace Framework versions starting with .NET Framework iv.half-dozen.

Customs-maintained tools are available to assist detect which .Net Framework versions are installed:

  • https://github.com/jmalarcon/DotNetVersions

    A .NET Framework ii.0 command-line tool.

  • https://github.com/EliteLoser/DotNetVersionLister

    A PowerShell 2.0 module.

For information about detecting the installed updates for each version of .Net Framework, see How to: Determine which .Cyberspace Framework updates are installed.

Make up one's mind which .Cyberspace implementation and version an app is running on

Yous tin can use the RuntimeInformation.FrameworkDescription property to query for which .NET implementation and version your app is running on. If the app is running on .Cyberspace Framework, the output will exist similar to:

              .NET Framework 4.8.4250.0                          

By comparison, if the app is running on .Net Core or .NET 5+, the output will exist like to:

              .Net Core three.1.9 .Cyberspace 5.0.0                          

Observe .Net Framework 4.v and later versions

The version of .Net Framework (4.5 and later) installed on a machine is listed in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full. If the Full subkey is missing, then .NET Framework 4.v or above isn't installed.

Notation

The Net Framework Setup subkey in the registry path does non begin with a menstruum.

The Release REG_DWORD value in the registry represents the version of .Internet Framework installed.

.Cyberspace Framework version Value of Release
.NET Framework 4.5 All Windows operating systems: 378389
.NET Framework iv.v.1 On Windows 8.1 and Windows Server 2012 R2: 378675
On all other Windows operating systems: 378758
.NET Framework 4.5.ii All Windows operating systems: 379893
.Cyberspace Framework four.6 On Windows 10: 393295
On all other Windows operating systems: 393297
.NET Framework 4.half-dozen.1 On Windows ten November Update systems: 394254
On all other Windows operating systems (including Windows 10): 394271
.NET Framework 4.six.2 On Windows 10 Ceremony Update and Windows Server 2016: 394802
On all other Windows operating systems (including other Windows 10 operating systems): 394806
.NET Framework 4.7 On Windows 10 Creators Update: 460798
On all other Windows operating systems (including other Windows 10 operating systems): 460805
.Cyberspace Framework 4.7.1 On Windows 10 Autumn Creators Update and Windows Server, version 1709: 461308
On all other Windows operating systems (including other Windows 10 operating systems): 461310
.NET Framework 4.seven.2 On Windows x April 2018 Update and Windows Server, version 1803: 461808
On all Windows operating systems other than Windows 10 April 2018 Update and Windows Server, version 1803: 461814
.Cyberspace Framework four.8 On Windows 10 May 2019 Update and Windows 10 Nov 2019 Update: 528040
On Windows 10 May 2020 Update and Windows 10 October 2020 Update and Windows x May 2021 Update: 528372
On Windows 11 and Windows Server 2022: 528449
On all other Windows operating systems (including other Windows ten operating systems): 528049

Minimum version

To determine whether a minimum version of .NET Framework is nowadays, check for a Release REG_DWORD value that's greater than or equal to the corresponding value listed in the post-obit table. For example, if your application runs under .Cyberspace Framework four.8 or a subsequently version, exam for a Release REG_DWORD value that'south greater than or equal to 528040.

.Internet Framework version Minimum value
.NET Framework 4.5 378389
.Net Framework 4.5.ane 378675
.Internet Framework four.5.2 379893
.NET Framework 4.6 393295
.NET Framework 4.six.1 394254
.NET Framework four.6.2 394802
.Cyberspace Framework 4.7 460798
.Internet Framework four.7.ane 461308
.NET Framework four.7.two 461808
.NET Framework 4.8 528040

Use Registry Editor

  1. From the Start card, cull Run, enter regedit, and so select OK.

    (You must have authoritative credentials to run regedit.)

  2. In the Registry Editor, open the following subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full. If the Total subkey isn't present, and so y'all don't accept .Net Framework four.5 or later on installed.

  3. Check for a REG_DWORD entry named Release. If it exists, then you have .NET Framework 4.5 or later installed. Its value corresponds to a particular version of .Internet Framework. In the following effigy, for example, the value of the Release entry is 528040, which is the release key for .NET Framework four.viii.

    Registry entry for .NET Framework 4.5

Use PowerShell to bank check for a minimum version

Use PowerShell commands to cheque the value of the Release entry of the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Framework Setup\NDP\v4\Full subkey.

The post-obit examples check the value of the Release entry to determine whether .NET Framework 4.6.2 or later is installed. This code returns True if information technology'due south installed and False otherwise.

              (Go-ItemProperty "HKLM:\SOFTWARE\Microsoft\Internet Framework Setup\NDP\v4\Full").Release -ge 394802                          

Query the registry using code

  1. Use the RegistryKey.OpenBaseKey and RegistryKey.OpenSubKey methods to access the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full subkey in the Windows registry.

    Important

    If the app you're running is 32-bit and running in 64-bit Windows, the registry paths volition be different than previously listed. The 64-bit registry is available in the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ subkey. For example, the registry subkey for .NET Framework 4.5 is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Cyberspace Framework Setup\NDP\v4\Full.

  2. Bank check the Release REG_DWORD value to determine the installed version. To be forward-compatible, check for a value greater than or equal to the value listed in the .Internet Framework version table.

The following example checks the value of the Release entry in the registry to observe the versions of .NET Framework 4.five-4.eight that are installed.

Tip

Add the directive using Microsoft.Win32 or Imports Microsoft.Win32 at the tiptop of your lawmaking file if y'all haven't already washed and so.

              const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";  using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)) {     if (ndpKey != cipher && ndpKey.GetValue("Release") != null)     {         Console.WriteLine($".Net Framework Version: {CheckFor45PlusVersion((int)ndpKey.GetValue("Release"))}");     }     else     {         Console.WriteLine(".NET Framework Version 4.5 or after is non detected.");     } }  // Checking the version using >= enables forrad compatibility. string CheckFor45PlusVersion(int releaseKey) {     if (releaseKey >= 528040)         return "four.8 or later";     if (releaseKey >= 461808)         return "4.7.ii";     if (releaseKey >= 461308)         return "4.7.1";     if (releaseKey >= 460798)         render "iv.7";     if (releaseKey >= 394802)         return "four.half dozen.two";     if (releaseKey >= 394254)         return "4.vi.1";     if (releaseKey >= 393295)         return "four.six";     if (releaseKey >= 379893)         return "4.five.2";     if (releaseKey >= 378675)         return "4.5.1";     if (releaseKey >= 378389)         return "4.v";     // This lawmaking should never execute. A non-null release key should mean     // that four.five or later is installed.     return "No 4.5 or afterwards version detected"; }                          
              Private Sub Get45PlusFromRegistry()     Const subkey As String = "SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full\"      Using ndpKey As RegistryKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)         If ndpKey IsNot Nothing AndAlso ndpKey.GetValue("Release") IsNot Nil Then             Panel.WriteLine($".NET Framework Version: {CheckFor45PlusVersion(ndpKey.GetValue("Release"))}")         Else             Console.WriteLine(".Cyberspace Framework Version four.5 or later is not detected.")         Cease If     Terminate Using Cease Sub  ' Checking the version using >= enables frontward compatibility. Private Function CheckFor45PlusVersion(releaseKey As Integer) As String     If releaseKey >= 528040 Then         Return "4.eight or subsequently"     ElseIf releaseKey >= 461808 Then         Render "iv.7.2"     ElseIf releaseKey >= 461308 Then         Return "4.7.1"     ElseIf releaseKey >= 460798 Then         Return "4.7"     ElseIf releaseKey >= 394802 Then         Return "four.6.two"     ElseIf releaseKey >= 394254 So         Return "4.6.ane"     ElseIf releaseKey >= 393295 And then         Return "four.6"     ElseIf releaseKey >= 379893 Then         Return "four.five.2"     ElseIf releaseKey >= 378675 Then         Return "4.5.1"     ElseIf releaseKey >= 378389 Then         Return "4.v"     Stop If     ' This lawmaking should never execute. A non-null release cardinal should mean     ' that 4.5 or later is installed.     Return "No 4.5 or later version detected" Terminate Function                          

The example displays output like the following:

              .NET Framework Version: 4.6.1                          

This example follows the recommended practice for version checking:

  • It checks whether the value of the Release entry is greater than or equal to the value of the known release keys.
  • It checks in guild from most contempo version to earliest version.

Detect .Internet Framework one.0 through 4.0

Each version of .NET Framework from i.i to 4.0 is listed as a subkey at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP. The post-obit tabular array lists the path to each .Net Framework version. For most versions, there'south an Install REG_DWORD value of i to betoken this version is installed. In these subkeys, at that place's also a Version REG_SZ value that contains a version string.

Notation

The Net Framework Setup subkey in the registry path does not begin with a period.

Framework Version Registry Subkey Value
1.0 HKLM\Software\Microsoft\.NETFramework\Policy\v1.0\3705 Install REG_SZ equals 1
1.1 HKLM\Software\Microsoft\NET Framework Setup\NDP\v1.1.4322 Install REG_DWORD equals i
2.0 HKLM\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727 Install REG_DWORD equals one
3.0 HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.0\Setup InstallSuccess REG_DWORD equals i
3.5 HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5 Install REG_DWORD equals ane
4.0 Client Contour HKLM\Software\Microsoft\Net Framework Setup\NDP\v4\Client Install REG_DWORD equals 1
4.0 Total Profile HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full Install REG_DWORD equals 1

Of import

If the app yous're running is 32-flake and running in 64-bit Windows, the registry paths will be different than previously listed. The 64-fleck registry is bachelor in the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ subkey. For instance, the registry subkey for .Internet Framework 3.5 is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v3.5.

Observe that the registry path to the .Net Framework 1.0 subkey is unlike from the others.

Employ Registry Editor (older framework versions)

  1. From the Start menu, cull Run, enter regedit, and then select OK.

    You must take administrative credentials to run regedit.

  2. Open up the subkey that matches the version you want to check. Use the table in the Detect .NET Framework 1.0 through four.0 department.

    The following figure shows the subkey and its Version value for .NET Framework 3.5.

    The registry entry for .NET Framework 3.5.

Query the registry using code (older framework versions)

Use the Microsoft.Win32.RegistryKey class to access the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cyberspace Framework Setup\NDP subkey in the Windows registry.

Of import

If the app y'all're running is 32-fleck and running in 64-bit Windows, the registry paths will be different than previously listed. The 64-bit registry is available in the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ subkey. For example, the registry subkey for .NET Framework iii.5 is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v3.v.

The following example finds the versions of .Cyberspace Framework 1-four that are installed:

              // Open up the registry cardinal for the .Cyberspace Framework entry. using (RegistryKey ndpKey =         RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).         OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\")) {     foreach (var versionKeyName in ndpKey.GetSubKeyNames())     {         // Skip .Internet Framework 4.5 version data.         if (versionKeyName == "v4")         {             go along;         }          if (versionKeyName.StartsWith("five"))         {             RegistryKey versionKey = ndpKey.OpenSubKey(versionKeyName);              // Get the .Net Framework version value.             var proper name = (string)versionKey.GetValue("Version", "");             // Get the service pack (SP) number.             var sp = versionKey.GetValue("SP", "").ToString();              // Get the installation flag.             var install = versionKey.GetValue("Install", "").ToString();             if (string.IsNullOrEmpty(install))             {                 // No install info; information technology must be in a kid subkey.                 Console.WriteLine($"{versionKeyName}  {name}");             }             else if (install == "1")             {                 // Install = one ways the version is installed.                  if (!string.IsNullOrEmpty(sp))                 {                     Panel.WriteLine($"{versionKeyName}  {name}  SP{sp}");                 }                 else                 {                     Console.WriteLine($"{versionKeyName}  {proper name}");                 }             }              if (!string.IsNullOrEmpty(proper noun))             {                 proceed;             }             // else print out info from subkeys...              // Iterate through the subkeys of the version subkey.             foreach (var subKeyName in versionKey.GetSubKeyNames())             {                 RegistryKey subKey = versionKey.OpenSubKey(subKeyName);                 name = (string)subKey.GetValue("Version", "");                 if (!string.IsNullOrEmpty(name))                     sp = subKey.GetValue("SP", "").ToString();                  install = subKey.GetValue("Install", "").ToString();                 if (string.IsNullOrEmpty(install))                 {                     // No install info; it must be later.                     Panel.WriteLine($"{versionKeyName}  {proper noun}");                 }                 else if (install == "one")                 {                     if (!string.IsNullOrEmpty(sp))                     {                         Panel.WriteLine($"{subKeyName}  {proper noun}  SP{sp}");                     }                     else                     {                         Console.WriteLine($"  {subKeyName}  {name}");                     }                 }             }         }     } }                          
              ' Opens the registry key for the .NET Framework entry. Using ndpKey As RegistryKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).     OpenSubKey("SOFTWARE\Microsoft\Internet Framework Setup\NDP\")      For Each versionKeyName In ndpKey.GetSubKeyNames()         ' Skip .Internet Framework iv.v and later.         If versionKeyName = "v4" Then Proceed For          If versionKeyName.StartsWith("v") And then             Dim versionKey Equally RegistryKey = ndpKey.OpenSubKey(versionKeyName)             ' Get the .NET Framework version value.             Dim name = DirectCast(versionKey.GetValue("Version", ""), Cord)             ' Get the service pack (SP) number.             Dim sp = versionKey.GetValue("SP", "").ToString()              Dim install = versionKey.GetValue("Install", "").ToString()             If String.IsNullOrEmpty(install) Then                 ' No install info; it must exist in a kid subkey.                 Console.WriteLine($"{versionKeyName}  {name}")             ElseIf install = "ane" Then                  If Not String.IsNullOrEmpty(sp) And so                     Panel.WriteLine($"{versionKeyName}  {proper name}  SP{sp}")                 Else                     Console.WriteLine($"{versionKeyName}  {name}")                 Terminate If              Stop If              If Not String.IsNullOrEmpty(name) Then                 Continue For             End If              For Each subKeyName In versionKey.GetSubKeyNames()                 Dim subKey As RegistryKey = versionKey.OpenSubKey(subKeyName)                 name = DirectCast(subKey.GetValue("Version", ""), Cord)                 If Not String.IsNullOrEmpty(name) And then                     sp = subKey.GetValue("SP", "").ToString()                 End If                  install = subKey.GetValue("Install", "").ToString()                 If String.IsNullOrEmpty(install) So                     ' No install info; information technology must be later.                     Console.WriteLine($"{versionKeyName}  {name}")                 ElseIf install = "1" Then                      If Not Cord.IsNullOrEmpty(sp) Then                         Console.WriteLine($"{subKeyName}  {proper name}  SP{sp}")                     Else                         Panel.WriteLine($"  {subKeyName}  {name}")                     End If                  End If             Side by side         Finish If     Next End Using                          

The example displays output similar to the following:

              v2.0.50727  2.0.50727.4927  SP2 v3.0  3.0.30729.4926  SP2 v3.5  3.five.30729.4926  SP1 v4.0   Customer  iv.0.0.0                          

Discover CLR versions

The .NET Framework CLR installed with .Internet Framework is versioned separately. There are two means to detect the version of the .NET Framework CLR:

  • The Clrver.exe tool

    Use the CLR Version tool (Clrver.exe) to decide which versions of the CLR are installed on a computer. Open up Visual Studio Developer Control Prompt or Visual Studio Programmer PowerShell and enter clrver.

    Sample output:

                      Versions installed on the machine: v2.0.50727 v4.0.30319                                  
  • The Environment class

    Of import

    For .NET Framework iv.5 and later versions, don't apply the Environment.Version belongings to notice the version of the CLR. Instead, query the registry as described in Discover .NET Framework four.5 and afterwards versions.

    1. Query the Surroundings.Version belongings to retrieve a Version object.

      The returned Arrangement.Version object identifies the version of the runtime that'south currently executing the lawmaking. Information technology doesn't return assembly versions or other versions of the runtime that may have been installed on the computer.

      For .NET Framework versions 4, 4.5, iv.5.1, and 4.5.2, the cord representation of the returned Version object has the form iv.0.30319.xxxxx, where xxxxx is less than 42000. For .NET Framework 4.6 and subsequently versions, information technology has the grade iv.0.30319.42000.

    2. After you have the Version object, query it as follows:

      • For the major release identifier (for case, 4 for version iv.0), employ the Version.Major holding.

      • For the pocket-sized release identifier (for case, 0 for version 4.0), use the Version.Pocket-size holding.

      • For the entire version string (for case, 4.0.30319.18010), use the Version.ToString method. This method returns a single value that reflects the version of the runtime that'due south executing the lawmaking. Information technology doesn't render assembly versions or other runtime versions that may be installed on the computer.

    The following example uses the Environment.Version property to call back CLR version data:

                      Panel.WriteLine($"Version: {Environment.Version}");                                  
                      Panel.WriteLine($"Version: {Surroundings.Version}")                                  

    The example displays output similar to the post-obit:

                      Version: 4.0.30319.18010                                  

See also

  • How to: Determine which .Internet Framework updates are installed
  • Install .Cyberspace Framework for developers
  • .Internet Framework versions and dependencies