Users can install and run multiple versions of the .NET Framework on their computers. When you develop or deploy your app, you might need to know which .NET Framework versions are installed on the user’s computer.
To get an accurate list of the .NET Framework versions installed on a computer, you can view the registry or query the registry in code. Note that the .NET Framework consists of two main components, which are versioned separately:
- A set of assemblies, which are collections of types and resources that provide the functionality for your apps. The .NET Framework and assemblies share the same version number.
- The common language runtime (CLR), which manages and executes your app’s code. The CLR is identified by its own version number (see Versions and Dependencies).
To get an accurate list of the .NET Framework versions installed on a computer, you can view the registry or query the registry in code:
Read the full how to ‘determine Which .NET Framework Versions Are Installed’ on Docs.microsoft.com: How to: Determine Which .NET Framework Versions Are Installed
In PowerShell use the
Get-ItemProperty cmdlet to get the installed .NET version:
(Get-ItemProperty "HKLM:Software\Microsoft\NET Framework Setup\NDP\v4\Full").Version
About .NET Framework versions: Did you know you can use the
/clr parameter of AppCmd to target multiple ASP.NET CLR versions with AppCmd? CLR stands for Common Language Runtime. Pretty neat heh? :)
Registry Value Types
A registry can store different types of values in various formats. These Registry Value Types are listed here. When you store data under a registry value, for instance by calling the RegSetValueEx function, you can specify one of the following values to indicate the type of data being stored. When you retrieve a registry value, functions such as RegQueryValueEx use these values to indicate the type of data retrieved.
The following registry value types are defined in Winnt.h.
Read more at Microsoft MSDN Registry Value Types.