Address
304 North Cardinal St.
Dorchester Center, MA 02124
Work Hours
Monday to Friday: 7AM - 7PM
Weekend: 10AM - 5PM
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 and here is how to check the .NET version.
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, so here is how to determine installed .NET Framework versions.
Get an accurate list of .NET Framework and .NET Core versions installed on your computer or server using PowerShell and the Windows Registry.
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:
So to check the .NET versions installed on a computer, you can view the Windows Registry or query the Registry in code use PowerShell. Also dotnet.exe
can lists installed versions, as can the dotnet-core-uninstall
tool. Use these to detect which versions of .NET Framework are installed on a machine.
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
The following table lists the available versions.
.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? ๐
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.
On Stack Overflow, Andriy Tolstoy lists a way to list the .NET Core runtimes available, and the SDKs, using PowerShell and dotnet.exe
:
(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 ๐
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 list & 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.
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 and report installed ASP.NET Framework versions using PowerShell.
This post showed you how to determine installed .NET Framework versions using various tools like PowerShell, the Windows Registry, dotnet.exe and dotnet-core-uninstall.exe. Use these in your DevOps scripts to find out which .NET versions are installed on a machine so you can target the correct version with your app.