Skip to content Skip to sidebar Skip to footer

how to tell what .net framework is installed

Skip to primary content

How to: Determine which .NET Framework versions are installed

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

.Cyberspace Framework consists of ii main components, which are versioned separately:

  • A ready of assemblies, which are collections of types and resource that provide the functionality for your apps. .NET Framework and the assemblies share the same version number. For example, .Cyberspace Framework versions include 4.5, 4.6.one, and iv.seven.2.

  • The common linguistic communication runtime (CLR), which manages and executes your app's code. 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 .NET Framework versions 4 through 4.5.2. CLR version greater than or equal to iv.0.30319.42000 supports .NET Framework versions starting with .Net Framework 4.6.

Community-maintained tools are bachelor to assistance detect which .NET Framework versions are installed:

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

    A .NET Framework two.0 control-line tool.

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

    A PowerShell ii.0 module.

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

Determine which .NET implementation and version an app is running on

You tin apply the RuntimeInformation.FrameworkDescription property to query for which .NET implementation and version your app is running on. If the app is running on .NET Framework, the output will be like to:

              .NET Framework 4.eight.4250.0                          

By comparing, if the app is running on .Internet Cadre or .Net 5+, the output volition be similar to:

              .NET Core 3.1.nine .NET v.0.0                          

Detect .NET Framework 4.5 and later versions

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

Note

The Internet Framework Setup subkey in the registry path does not begin with a flow.

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

.Net Framework version Value of Release
.NET Framework 4.5 All Windows operating systems: 378389
.Cyberspace Framework iv.5.i On Windows 8.1 and Windows Server 2012 R2: 378675
On all other Windows operating systems: 378758
.Net Framework four.5.2 All Windows operating systems: 379893
.Net Framework four.6 On Windows 10: 393295
On all other Windows operating systems: 393297
.NET Framework four.6.1 On Windows x Nov Update systems: 394254
On all other Windows operating systems (including Windows 10): 394271
.Cyberspace Framework 4.half-dozen.two On Windows 10 Anniversary Update and Windows Server 2016: 394802
On all other Windows operating systems (including other Windows x operating systems): 394806
.Cyberspace Framework 4.7 On Windows 10 Creators Update: 460798
On all other Windows operating systems (including other Windows 10 operating systems): 460805
.Net Framework 4.vii.1 On Windows 10 Fall Creators Update and Windows Server, version 1709: 461308
On all other Windows operating systems (including other Windows x operating systems): 461310
.NET Framework four.7.two On Windows ten April 2018 Update and Windows Server, version 1803: 461808
On all Windows operating systems other than Windows x April 2018 Update and Windows Server, version 1803: 461814
.NET Framework 4.eight On Windows 10 May 2019 Update and Windows 10 Nov 2019 Update: 528040
On Windows 10 May 2020 Update and Windows ten October 2020 Update and Windows 10 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 decide whether a minimum version of .Net Framework is present, bank check for a Release REG_DWORD value that'southward greater than or equal to the corresponding value listed in the following table. For instance, if your application runs under .Net Framework four.8 or a after version, examination for a Release REG_DWORD value that'due south greater than or equal to 528040.

.Net Framework version Minimum value
.NET Framework iv.5 378389
.Internet Framework 4.5.1 378675
.Net Framework 4.five.ii 379893
.NET Framework 4.6 393295
.NET Framework 4.6.i 394254
.NET Framework four.6.ii 394802
.Internet Framework iv.seven 460798
.NET Framework 4.seven.1 461308
.NET Framework four.7.2 461808
.Net Framework 4.eight 528040

Use Registry Editor

  1. From the First menu, choose Run, enter regedit, and then select OK.

    (You must take administrative credentials to run regedit.)

  2. In the Registry Editor, open up the following subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Framework Setup\NDP\v4\Full. If the Full subkey isn't present, then y'all don't have .NET Framework 4.5 or later installed.

  3. Check for a REG_DWORD entry named Release. If it exists, and so you have .NET Framework iv.5 or subsequently installed. Its value corresponds to a particular version of .NET Framework. In the post-obit figure, for case, the value of the Release entry is 528040, which is the release key for .Cyberspace Framework 4.8.

    Registry entry for .NET Framework 4.5

Use PowerShell to cheque for a minimum version

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

The following examples check the value of the Release entry to determine whether .Internet Framework four.6.2 or after is installed. This code returns Truthful if it's installed and Faux otherwise.

              (Go-ItemProperty "HKLM:\SOFTWARE\Microsoft\Net 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-scrap and running in 64-bit Windows, the registry paths volition exist dissimilar than previously listed. The 64-flake registry is bachelor 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\NET Framework Setup\NDP\v4\Full.

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

The following example checks the value of the Release entry in the registry to find the versions of .NET Framework 4.5-4.8 that are installed.

Tip

Add the directive using Microsoft.Win32 or Imports Microsoft.Win32 at the top of your code file if you oasis't already washed so.

              const string subkey = @"SOFTWARE\Microsoft\Internet Framework Setup\NDP\v4\Full\";  using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)) {     if (ndpKey != naught && ndpKey.GetValue("Release") != null)     {         Console.WriteLine($".NET Framework Version: {CheckFor45PlusVersion((int)ndpKey.GetValue("Release"))}");     }     else     {         Console.WriteLine(".Cyberspace Framework Version 4.five or later is not detected.");     } }  // Checking the version using >= enables forward compatibility. cord CheckFor45PlusVersion(int releaseKey) {     if (releaseKey >= 528040)         render "4.viii or after";     if (releaseKey >= 461808)         return "4.vii.ii";     if (releaseKey >= 461308)         return "iv.7.one";     if (releaseKey >= 460798)         return "iv.7";     if (releaseKey >= 394802)         render "four.six.2";     if (releaseKey >= 394254)         return "4.half-dozen.1";     if (releaseKey >= 393295)         return "4.six";     if (releaseKey >= 379893)         render "iv.5.two";     if (releaseKey >= 378675)         render "four.v.1";     if (releaseKey >= 378389)         return "4.5";     // This lawmaking should never execute. A non-null release key should mean     // that 4.v or subsequently is installed.     render "No 4.5 or later version detected"; }                          
              Private Sub Get45PlusFromRegistry()     Const subkey As String = "SOFTWARE\Microsoft\Cyberspace 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 Nada Then             Panel.WriteLine($".NET Framework Version: {CheckFor45PlusVersion(ndpKey.GetValue("Release"))}")         Else             Console.WriteLine(".NET Framework Version 4.5 or later is non detected.")         Finish If     End Using Cease Sub  ' Checking the version using >= enables frontwards compatibility. Individual Function CheckFor45PlusVersion(releaseKey As Integer) As Cord     If releaseKey >= 528040 Then         Render "4.viii or later"     ElseIf releaseKey >= 461808 Then         Return "4.7.2"     ElseIf releaseKey >= 461308 And so         Render "four.7.one"     ElseIf releaseKey >= 460798 Then         Return "4.7"     ElseIf releaseKey >= 394802 So         Render "4.6.2"     ElseIf releaseKey >= 394254 And then         Return "4.6.1"     ElseIf releaseKey >= 393295 Then         Return "iv.six"     ElseIf releaseKey >= 379893 Then         Render "4.5.2"     ElseIf releaseKey >= 378675 And then         Return "4.5.one"     ElseIf releaseKey >= 378389 Then         Return "4.v"     End If     ' This lawmaking should never execute. A non-nix release central should mean     ' that 4.5 or later is installed.     Return "No four.5 or later version detected" Finish Part                          

The case displays output like the following:

              .NET Framework Version: four.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.
  • Information technology checks in order from most recent version to primeval version.

Detect .Internet Framework 1.0 through 4.0

Each version of .Cyberspace Framework from 1.1 to iv.0 is listed equally a subkey at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP. The following table lists the path to each .Net Framework version. For most versions, there'south an Install REG_DWORD value of 1 to indicate this version is installed. In these subkeys, there'southward also a Version REG_SZ value that contains a version string.

Notation

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

Framework Version Registry Subkey Value
ane.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 1
2.0 HKLM\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727 Install REG_DWORD equals ane
3.0 HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.0\Setup InstallSuccess REG_DWORD equals one
three.5 HKLM\Software\Microsoft\Internet Framework Setup\NDP\v3.5 Install REG_DWORD equals 1
4.0 Customer Contour HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client Install REG_DWORD equals i
4.0 Full Profile HKLM\Software\Microsoft\Internet Framework Setup\NDP\v4\Full Install REG_DWORD equals i

Of import

If the app you're running is 32-flake and running in 64-chip 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 .Cyberspace Framework 3.five is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v3.5.

Notice that the registry path to the .Cyberspace Framework 1.0 subkey is different from the others.

Use Registry Editor (older framework versions)

  1. From the Offset bill of fare, choose Run, enter regedit, and so select OK.

    Y'all must have administrative credentials to run regedit.

  2. Open the subkey that matches the version y'all desire to bank check. Employ the tabular array in the Discover .Net Framework i.0 through 4.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\Internet Framework Setup\NDP subkey in the Windows registry.

Important

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

The following example finds the versions of .Internet Framework ane-4 that are installed:

              // Open up the registry cardinal for the .NET 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.v version data.         if (versionKeyName == "v4")         {             continue;         }          if (versionKeyName.StartsWith("5"))         {             RegistryKey versionKey = ndpKey.OpenSubKey(versionKeyName);              // Get the .Net Framework version value.             var proper noun = (string)versionKey.GetValue("Version", "");             // Go 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; it must be in a child subkey.                 Panel.WriteLine($"{versionKeyName}  {name}");             }             else if (install == "1")             {                 // Install = 1 ways the version is installed.                  if (!cord.IsNullOrEmpty(sp))                 {                     Console.WriteLine($"{versionKeyName}  {proper name}  SP{sp}");                 }                 else                 {                     Console.WriteLine($"{versionKeyName}  {name}");                 }             }              if (!string.IsNullOrEmpty(proper name))             {                 continue;             }             // else impress out info from subkeys...              // Iterate through the subkeys of the version subkey.             foreach (var subKeyName in versionKey.GetSubKeyNames())             {                 RegistryKey subKey = versionKey.OpenSubKey(subKeyName);                 proper noun = (string)subKey.GetValue("Version", "");                 if (!cord.IsNullOrEmpty(proper noun))                     sp = subKey.GetValue("SP", "").ToString();                  install = subKey.GetValue("Install", "").ToString();                 if (string.IsNullOrEmpty(install))                 {                     // No install info; information technology must be later.                     Console.WriteLine($"{versionKeyName}  {proper noun}");                 }                 else if (install == "ane")                 {                     if (!string.IsNullOrEmpty(sp))                     {                         Panel.WriteLine($"{subKeyName}  {name}  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\Cyberspace Framework Setup\NDP\")      For Each versionKeyName In ndpKey.GetSubKeyNames()         ' Skip .NET Framework four.5 and later.         If versionKeyName = "v4" Then Continue For          If versionKeyName.StartsWith("v") Then             Dim versionKey As RegistryKey = ndpKey.OpenSubKey(versionKeyName)             ' Go the .Internet Framework version value.             Dim proper noun = 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) So                 ' No install info; it must be in a child subkey.                 Console.WriteLine($"{versionKeyName}  {proper name}")             ElseIf install = "1" Then                  If Not Cord.IsNullOrEmpty(sp) And so                     Console.WriteLine($"{versionKeyName}  {name}  SP{sp}")                 Else                     Console.WriteLine($"{versionKeyName}  {proper name}")                 End If              End If              If Not String.IsNullOrEmpty(proper name) So                 Continue For             End If              For Each subKeyName In versionKey.GetSubKeyNames()                 Dim subKey As RegistryKey = versionKey.OpenSubKey(subKeyName)                 proper noun = DirectCast(subKey.GetValue("Version", ""), Cord)                 If Not String.IsNullOrEmpty(name) And so                     sp = subKey.GetValue("SP", "").ToString()                 End If                  install = subKey.GetValue("Install", "").ToString()                 If String.IsNullOrEmpty(install) Then                     ' No install info; it must be later on.                     Console.WriteLine($"{versionKeyName}  {name}")                 ElseIf install = "1" Then                      If Non String.IsNullOrEmpty(sp) So                         Console.WriteLine($"{subKeyName}  {proper noun}  SP{sp}")                     Else                         Panel.WriteLine($"  {subKeyName}  {name}")                     End If                  Finish If             Next         End If     Next Finish Using                          

The case displays output similar to the following:

              v2.0.50727  2.0.50727.4927  SP2 v3.0  iii.0.30729.4926  SP2 v3.five  3.5.30729.4926  SP1 v4.0   Client  4.0.0.0                          

Observe CLR versions

The .NET Framework CLR installed with .NET Framework is versioned separately. There are two ways 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 Visual Studio Developer Command Prompt or Visual Studio Developer PowerShell and enter clrver.

    Sample output:

                      Versions installed on the machine: v2.0.50727 v4.0.30319                                  
  • The Surround course

    Important

    For .NET Framework iv.5 and later versions, don't employ the Environs.Version property to detect the version of the CLR. Instead, query the registry as described in Detect .NET Framework 4.5 and afterwards versions.

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

      The returned Organization.Version object identifies the version of the runtime that'southward currently executing the code. It doesn't return assembly versions or other versions of the runtime that may have been installed on the computer.

      For .NET Framework versions 4, four.5, 4.5.ane, and iv.5.2, the string representation of the returned Version object has the grade 4.0.30319.xxxxx, where xxxxx is less than 42000. For .NET Framework four.6 and afterward versions, it has the form 4.0.30319.42000.

    2. After y'all accept the Version object, query it as follows:

      • For the major release identifier (for example, 4 for version 4.0), use the Version.Major property.

      • For the minor release identifier (for example, 0 for version 4.0), use the Version.Small-scale property.

      • For the entire version cord (for example, 4.0.30319.18010), use the Version.ToString method. This method returns a single value that reflects the version of the runtime that's executing the code. It doesn't return associates versions or other runtime versions that may be installed on the computer.

    The following example uses the Environment.Version property to retrieve CLR version information:

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

    The instance displays output similar to the following:

                      Version: iv.0.30319.18010                                  

See also

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

suttonoformetake.blogspot.com

Source: https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed

Post a Comment for "how to tell what .net framework is installed"