This article aims to explore various methods to determine the installed .NET Framework versions.
What is .NET Framework?
Before delving into assessing the installed versions, it is vital to comprehend the significance of the .NET Framework. Developed by Microsoft, this software framework offers a comprehensive and consistent programming model for building applications that can run on various platforms, from desktop to web and mobile.
There are two main parts of the .NET Framework, and each is versioned separately:
- A collection of assemblies, which are types and resource collections that provide your programs with their functionality. The assemblies and the .NET Framework have the same version number. For instance, versions of the .NET Framework include 4.5, 4.6.1, and 4.7.2.
- The common language runtime (CLR) is responsible for managing and running the code for your app. Usually, different .NET Framework versions are supported by the same CLR version. For instance, CLR versions more than or equal to 4.0.30319.42000 support .NET Framework versions beginning with .NET Framework 4.6, while CLR versions are less than or equal to 4.0.30319.xxxxx support .NET Framework versions 4 through 4.5.2.
Importance of Determining the .NET Framework Versions
Determining the installed .NET Framework versions is vital for efficient application development and deployment. Different versions may introduce new features, security enhancements, and bug fixes, which can profoundly impact an application’s behavior and compatibility.
Additionally, determining the framework versions is essential for resolving compatibility issues and ensuring optimal performance, as choosing the correct framework version will ensure that all dependencies are met.
Determining the .NET Framework 4.5 Versions and Later
A computer’s installed .NET Framework version (4.5 and later) is listed in the registry at the “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full” path. The full subkey must be present for the .NET Framework 4.5 or above to be installed.
The Release REG_DWORD value in the Registry serves as a representation of the .NET Framework version that is currently installed. Following are the versions and their respective release values:
.NET Framework Version | Release Value |
---|---|
.NET Framework 4.5 | All Windows operating systems: 378389 |
.NET Framework 4.5.1 | On Windows 8.1 and Windows Server 2012 R2: 378675
On all other Windows operating systems: 378758 |
.NET Framework 4.5.2 | All Windows operating systems: 379893 |
.NET Framework 4.6 | On Windows 10: 393295
On all other Windows operating systems: 393297 |
.NET Framework 4.6.1 | On Windows 10 November Update systems: 394254
On all other Windows operating systems (including Windows 10): 394271 |
.NET Framework 4.6.2 | On Windows 10 Anniversary 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 |
.NET Framework 4.7.1 | On Windows 10 Fall Creators Update and Windows Server, version 1709: 461308
On all other Windows operating systems (including other Windows 10 operating systems): 461310 |
.NET Framework 4.7.2 | On Windows 10 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 |
.NET Framework 4.8 | On Windows 10 May 2019 Update and Windows 10 November 2019 Update: 528040
On Windows 10 May 2020 Update, October 2020 Update, May 2021 Update, November 2021 Update, and 2022 Update: 528372 On Windows 11 and Windows Server 2022: 528449 On all other Windows operating systems (including other Windows 10 operating systems): 528049 |
.NET Framework 4.8.1 | On Windows 11 2022 Update: 533320
All other Windows operating systems: 533325 |
Determining the Installed .NET Framework Versions Using PowerShell
One method to determine the installed .NET Framework versions is by utilizing command-line tools such as “PowerShell“. These tools allow developers to access and inspect the Windows registry settings, where the installed versions of the .NET Framework are stored. By referencing specific registry keys and values, it is possible to identify the installed framework versions accurately.
You can refer to the below-given code to determine the installed .NET Framework versions:
switch ($release) {
{ $_ -ge 533320 } { $version = '4.8.1 or later'; break }
{ $_ -ge 528040 } { $version = '4.8'; break }
{ $_ -ge 461808 } { $version = '4.7.2'; break }
{ $_ -ge 461308 } { $version = '4.7.1'; break }
{ $_ -ge 460798 } { $version = '4.7'; break }
{ $_ -ge 394802 } { $version = '4.6.2'; break }
{ $_ -ge 394254 } { $version = '4.6.1'; break }
{ $_ -ge 393295 } { $version = '4.6'; break }
{ $_ -ge 379893 } { $version = '4.5.2'; break }
{ $_ -ge 378675 } { $version = '4.5.1'; break }
{ $_ -ge 378389 } { $version = '4.5'; break }
default { $version = $null; break }
}
if ($version) {
Write-Host -Object ".NET Framework Version: $version"
} else {
Write-Host -Object '.NET Framework Version 4.5 or later is not detected.'
}
The above code checks if the release entry’s value is greater than or equal to the values of the known release keys, as follows:
Determining the Installed .NET Framework Versions Using Registry Editor
Follow the below-provided steps to analyze the installed .NET framework versions:
Step 1: Trigger the “Ctrl+R” shortcut keys to open the “Run” dialogue box, type “regedit”, and then click “OK”:
Note: To use regedit, you must have administrator rights.
Step 2: Now, navigate to the “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full” path. The .NET Framework 4.5 or later is not installed if the “Full” subkey is absent. However, it is not the case here:
Step 3: Look for the “Release” entry. You will have .NET Framework 4.5 or later installed if it is present. Its value is associated with a specific .NET Framework version. For instance, the release key for the “.NET Framework 4.8” is 533325 in the accompanying figure’s value for the Release field:
Conclusion
Developers must possess a thorough understanding of determining the installed .NET Framework versions on the system. By utilizing methods such as analyzing the PowerShell, or Windows Registry, developers can make informed decisions when developing applications that align with the available framework versions.