Each new .Net Framework version has new opportunities, so when deploying a new app, it’s better to know for sure what versions are installed on the computer. You can get a list of .NET Framework versions in several ways.
The information about the installed .Net versions is stored in the registry. To get it, open the Registry Editor (regedit.exe) and go to HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP, in which all versions installed in the system are listed. The detailed information is stored in the sections with the version name, and in case of version 4.0 and later — in Client or Full subsections. Here are some parameters:
- Install -version install flag
- Version – the full version number
- Install Path – is the directory, to which the program is installed
- Release- release version
As a rule, it is required to know the number of the latest version. You can get it from the Release parameter, for example:
378389 — .Net Framework 4.5;
378675 — .Net Framework 4.5.1 in Windows 8.1 and Windows Server 2012 R2;
378758 — .Net Framework 4.5.1 in Windows 7/8 and Windows Server 2008/2012;
379893 — .Net Framework 4.5.2.
As an alternative to the Registry Editor, you can use PowerShell. The registry can be accessed from PowerShell using a provider, which allows to view registry branches as folders in a file system. For example, you can view the contents of HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full using this command:
dir ′HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full′
You can also view the numbers of the installed .NET Framework versions with third-party apps, like Asoft .Net Version Detector. The app doesn’t need to be installed, you just unpack and run it. It displays all installed .NET versions on the computer, and shows the latest available version to date.
To sum up, I’ll remind that in server OSs since Windows Server 2012, basic .Net versions (3.5 and 4.5) are integrated in the system and installed as a component (Feature), and minor versions (4.5.1, 4.5.2, etc.) come with updates from Windows Update. You can see a detailed description of .Net versions on MSDN.