How to: Determine which .NET Framework versions are installed

Users can install and run multiple .NET Framework versions on their computers. When you develop or deploy your app, you might need to know which .NET versions are installed on a machine.
Published on Thursday, 7 September 2017

Use PowerShell to detect which versions of .NET Framework are installed on a machine by querying the Windows registry.

Determine the .NET Framework and ASP.NET Framework version installed

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 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

Check for a DWORD value named Release. The existence of the Release DWORD indicates that the .NET Framework 4.5 or newer has been installed on that computer.

(Get-ItemProperty "HKLM:Software\Microsoft\NET Framework Setup\NDP\v4\Full").Release
.NET Framework version Value of the Release DWORD
.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: 528040. On all others Windows operating systems (including other Windows 10 operating systems): 528049. On Windows 11 and Windows Server 2022: 528449
.NET Framework 4.8.1 On Windows 11 2022 Update and Windows 11 2023 Update: 533320. All other Windows operating systems: 533325

(table copied from the earlier mentioned docs.microsoft.com article)

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? :)

Is .NET and .NET Core installed? What are the versions?

If you want to know whether .NET and / or .NET Core is installed and, if yes, the available versions, you can use the dotnet executable and PowerShell. Here are a couple of options for you.

Dotnet executable

On Stack Overflow, Andriy Tolstoy lists a way to list the .NET Core runtimes available, and the SDK's:

(dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name
(dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'sdk')).Name

Its output is for example:

PS C:\Users\janreilink> (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name
2.1.30
3.1.20
3.1.31
3.1.32
5.0.11
5.0.17
6.0.11
6.0.13
6.0.14
7.0.2
PS C:\Users\janreilink> (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'sdk')).Name
3.1.426
5.0.402
5.0.408
5.0.414
6.0.114
6.0.406
7.0.102

Of course dotnet also has a simple --list-runtimes command argument:

PS C:\Users\janreilink> dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Yes, I need to do some cleanup :-)

Dotnet-core-uninstall

Have dotnet-core-uninstall.exe installed? It's a pain, but I recommend it. You can feed the dotnet uninstall tool all kinds of arguments, it can remove the hosting-bundle, runtime, aspnet-runtime, major versions and minor versions. And it can report installed versions, sweet! See:

PS C:\Users\janreilink> &'C:\Program Files (x86)\dotnet-core-uninstall\dotnet-core-uninstall.exe' list

This tool cannot uninstall versions of the runtime or SDK that are 
    - SDKs installed using Visual Studio 2019 Update 3 or later.
    - SDKs and runtimes installed via zip/scripts.
    - Runtimes installed with SDKs (these should be removed by removing that SDK).
The versions that can be uninstalled with this tool are:

.NET Core SDKs:

.NET Core Runtimes:
  7.0.3   x86
  7.0.3   x64
  6.0.14  x86
  6.0.14  x64

ASP.NET Core Runtimes:
  7.0.3   x86
  7.0.3   x64
  6.0.14  x86
  6.0.14  x64

.NET Core Runtime & Hosting Bundles:
  7.0.3
  6.0.14

The tool has extensive documentation, read .NET uninstall tool and How to remove the .NET Runtime and SDK at Microsoft Learn.

PowerShell and the Windows Registry

On Microsoft's Technet Script Center gallery, you may find an additional How to determine ASP.NET Core installation on a Windows Server by PowerShell recipe contributed by OneScript Team:

$DotNETCoreUpdatesPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates\.NET Core" 
$DotNetCoreItems = Get-Item -ErrorAction Stop -Path $DotNETCoreUpdatesPath 
$NotInstalled = $True 
$DotNetCoreItems.GetSubKeyNames() | Where { $_ -Match "Microsoft .NET Core.*Windows Server Hosting" } | ForEach-Object {
  $NotInstalled = $False 
  Write-Host "The host has installed $_" 
} 
If ($NotInstalled) { 
  Write-Host "Can not find ASP.NET Core installed on the host" 
}

An shorter version is:

$DotNetCoreItems = Get-Item -ErrorAction Stop -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates\.NET Core"
$DotNetCoreItems.GetSubKeyNames() | Where { $_ -Match "Microsoft .NET Core.*Windows Server Hosting" } | ForEach-Object {
  Write-Host ".NET Core versions found: $_" 
}

HTH, this was how to list installed ASP.NET versions using PowerShell.