This tool lists all available .NET Frameworks and checks the needed/linked .NET components of installed apps by selecting a target directory.
Introduction
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 target's computer. This article manages the rare (but possible) situation if there aren't any .NET Frameworks installed. For this purpose, it starts with a pure C++ application (Starter) that doesn't need any .NET components in order to check whether at least anyone .NET Framework is available. If yes, the main application starts and shows a GUI with located components. Now the user has a possibility, to select a directory to check all *.EXEs, *.DLLs and *.OCXs in it for fulfillment of .NET requirements.
Background
To get an accurate list of the .NET Framework versions installed on a computer, we need to view the registry. This feature is accompanied by Microsoft's document here. To find the .NET Framework 1 - 4, we need to use the following subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP
For Versions 4.5 and later, we are looking for the following subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
Value of the Release DWORD | Version |
378389 | .NET Framework 4.5 |
378675 | .NET Framework 4.5.1 installed with Windows 8.1 or Windows Server 2012 R2 |
378758 | .NET Framework 4.5.1 installed on Windows 8, Windows 7 SP1, or Windows Vista SP2 |
379893 | .NET Framework 4.5.2 |
Windows 10: 393295
On all other OS versions: 393297 | .NET Framework 4.6 |
Windows 10 November Update: 394254
On all other OS versions: 394271 | .NET Framework 4.6.1 |
Windows Server 2016: 394802
On all other OS versions: 394806 | .NET Framework 4.6.2 |
Windows 10 Creators Update: 460798
On all other OS versions: 460805 | .NET Framework 4.7 |
Windows 10 Creators Update: 461308
On all other OS versions: 461310 | .NET Framework 4.7.1 |
Windows 10 April 2018: 461808
On all other OS versions: 461814 | .NET Framework 4.7.2 |
That is exactly what the tool does:
int GetNetfxSpLevel(string pszNetfxRegKeyName, string pszNetfxRegValueName)
{
try
{
var oRet = Registry.GetValue(pszNetfxRegKeyName, pszNetfxRegValueName, "");
if (oRet != null)
return (Int32)oRet;
}
catch (Exception ex)
{
_oLog.Write(ex);
}
return -1;
}
Using the Tool
After starting the CheckDotNet.exe, you will see the following message box if absolutely no .NET Framework is available on your system:
However, this should be a very rare situation.
Most commonly, it will be found that one or more components and the CheckDotNet.exe will start the GUI application written in C#:
It lists the available vs. not installed components on the left.
On the right, you can scan the target directory to check whether all applications in it fulfill the .NET dependency.
There is now a CMD line mode, many thanks to LightTempler:
[UPDATE]
Updated to detect up to .NET 4.8.1, many thanks to Peter Thomas!
History
- Current version 1.0.0
- Added the command-line Version Win32Analyser.zip
- Updated to Version 2.0.0 by adding recognition of .NET 4.6.2, 4.7, 4.7.1, 4.7.2
- Updated to Version 3.2.0
- Updated to Version 10.1.0