In this article

Users can install & run multiple versions of .NET Framework on their computers. When you develop or deploy your app, you might need lớn know which .NET Framework versions are installed on the user"s computer. The registry contains a list of the versions of .NET Framework installed on the computer.

Bạn đang xem: Cách xem phiên bản net framework


Note

This article is specific khổng lồ .NET Framework. Lớn determine which .NET Core & .NET 5+ SDKs and runtimes are installed, see How to kiểm tra that .NET is already installed.


.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. .NET Framework và the assemblies mô tả the same version number. For example, .NET Framework versions include 4.5, 4.6.1, & 4.7.2.

Community-maintained tools are available to lớn help detect which .NET Framework versions are installed:

For information about detecting the installed updates for each version of .NET Framework, see How to: Determine which .NET Framework updates are installed.

Determine which .NET implementation and version an tiện ích is running on

You can use the Runtime
Information.Framework
Description property khổng lồ query for which .NET implementation và version your app is running on. If the phầm mềm is running on .NET Framework, the output will be similar to:

.NET Framework 4.8.4250.0By comparison, if the ứng dụng is running on .NET vi xử lý core or .NET 5+, the đầu ra will be similar to:

.NET core 3.1.9.NET 5.0.0

Detect .NET Framework 4.5 and later versions

The version of .NET Framework (4.5 and later) installed on a machine is listed in the registry at HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full. If the Full subkey is missing, then .NET Framework 4.5 or above isn"t installed.


The Release REG_DWORD value in the registry represents the version of .NET Framework installed.

.NET Framework version
Value of Release
.NET Framework 4.5All Windows operating systems: 378389
.NET Framework 4.5.1On Windows 8.1 & Windows server 2012 R2: 378675On all other Windows operating systems: 378758
.NET Framework 4.5.2All Windows operating systems: 379893
.NET Framework 4.6On Windows 10: 393295On all other Windows operating systems: 393297
.NET Framework 4.6.1On Windows 10 November Update systems: 394254On all other Windows operating systems (including Windows 10): 394271
.NET Framework 4.6.2On Windows 10 Anniversary Update and Windows server 2016: 394802On all other Windows operating systems (including other Windows 10 operating systems): 394806
.NET Framework 4.7On Windows 10 Creators Update: 460798On all other Windows operating systems (including other Windows 10 operating systems): 460805
.NET Framework 4.7.1On Windows 10 Fall Creators Update và Windows Server, version 1709: 461308On all other Windows operating systems (including other Windows 10 operating systems): 461310
.NET Framework 4.7.2On Windows 10 April 2018 Update & Windows Server, version 1803: 461808On all Windows operating systems other than Windows 10 April 2018 Update and Windows Server, version 1803: 461814
.NET Framework 4.8On Windows 10 May 2019 Update & Windows 10 November 2019 Update: 528040On Windows 10 May 2020 Update, October 2020 Update, May 2021 Update, November 2021 Update, & 2022 Update: 528372On Windows 11 và Windows vps 2022: 528449On all other Windows operating systems (including other Windows 10 operating systems): 528049
.NET Framework 4.8.1On Windows 11 2022 Update: 533320All other Windows operating systems: 533325

Minimum version

To determine whether a minimum version of .NET Framework is present, check for a Release REG_DWORD value that"s greater than or equal to the corresponding value listed in the following table. For example, if your application runs under .NET Framework 4.8 or a later version, demo for a Release REG_DWORD value that"s greater than or equal to 528040.

.NET Framework version
Minimum value
.NET Framework 4.5378389
.NET Framework 4.5.1378675
.NET Framework 4.5.2379893
.NET Framework 4.6393295
.NET Framework 4.6.1394254
.NET Framework 4.6.2394802
.NET Framework 4.7460798
.NET Framework 4.7.1461308
.NET Framework 4.7.2461808
.NET Framework 4.8528040
.NET Framework 4.8.1533320

Use Registry Editor

From the Start menu, choose Run, enter regedit, & then select OK.

(You must have administrative credentials lớn run regedit.)

In the Registry Editor, xuất hiện the following subkey: HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full. If the Full subkey isn"t present, then you don"t have .NET Framework 4.5 or later installed.

Check for a REG_DWORD entry named Release. If it exists, then you have .NET Framework 4.5 or later installed. Its value corresponds khổng lồ a particular version of .NET Framework. In the following figure, for example, the value of the Release entry is 528040, which is the release key for .NET Framework 4.8.

*

Use Power
Shell to kiểm tra for a minimum version

Use Power
Shell commands to kiểm tra the value of the Release entry of the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full subkey.

The following examples check the value of the Release entry lớn determine whether .NET Framework 4.6.2 or later is installed. This code returns True if it"s installed and False otherwise.

(Get-Item
Property
Value -Literal
Path "HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Full" -Name Release) -ge 394802

Query the registry using code

The following example checks the value of the Release entry in the registry to lớn find the versions of .NET Framework 4.5-4.8.1 that are installed.


Tip

Add the directive using Microsoft.Win32 or Imports Microsoft.Win32 at the top of your code file if you haven"t already done so.


"SOFTWAREMicrosoftNET Framework SetupNDPv4Full";using (var ndp
Key = Registry
Key.Open
Base
Key(Registry
Hive.Local
Machine, Registry
View.Registry32).Open
Sub
Key(subkey)) if (ndp
Key != null && ndp
Key.Get
Value("Release") != null) Console.Write
Line($".NET Framework Version: Check
For45Plus
Version((int)ndp
Key.Get
Value("Release"))"); else Console.Write
Line(".NET Framework Version 4.5 or later is not detected."); // Checking the version using >= enables forward compatibility.string Check
For45Plus
Version(int release
Key) if (release
Key >= 533320) return "4.8.1 or later"; if (release
Key >= 528040) return "4.8"; if (release
Key >= 461808) return "4.7.2"; if (release
Key >= 461308) return "4.7.1"; if (release
Key >= 460798) return "4.7"; if (release
Key >= 394802) return "4.6.2"; if (release
Key >= 394254) return "4.6.1"; if (release
Key >= 393295) return "4.6"; if (release
Key >= 379893) return "4.5.2"; if (release
Key >= 378675) return "4.5.1"; if (release
Key >= 378389) return "4.5"; // This code should never execute. A non-null release key should mean // that 4.5 or later is installed. Return "No 4.5 or later version detected";Private Sub Get45Plus
From
Registry() Const subkey As String = "SOFTWAREMicrosoftNET Framework SetupNDPv4Full" Using ndp
Key As Registry
Key = Registry
Key.Open
Base
Key(Registry
Hive.Local
Machine, Registry
View.Registry32).Open
Sub
Key(subkey) If ndp
Key Is
Not Nothing And
Also ndp
Key.Get
Value("Release") Is
Not Nothing Then Console.Write
Line($".NET Framework Version: Check
For45Plus
Version(ndp
Key.Get
Value("Release"))") Else Console.Write
Line(".NET Framework Version 4.5 or later is not detected.") end If kết thúc Using
End Sub' Checking the version using >= enables forward compatibility.Private Function Check
For45Plus
Version(release
Key As Integer) As String If release
Key >= 533320 Then Return "4.8.1 or later" Else
If release
Key >= 528040 Then Return "4.8" Else
If release
Key >= 461808 Then Return "4.7.2" Else
If release
Key >= 461308 Then Return "4.7.1" Else
If release
Key >= 460798 Then Return "4.7" Else
If release
Key >= 394802 Then Return "4.6.2" Else
If release
Key >= 394254 Then Return "4.6.1" Else
If release
Key >= 393295 Then Return "4.6" Else
If release
Key >= 379893 Then Return "4.5.2" Else
If release
Key >= 378675 Then Return "4.5.1" Else
If release
Key >= 378389 Then Return "4.5" kết thúc If ' This code should never execute. A non-null release key should mean ' that 4.5 or later is installed. Return "No 4.5 or later version detected"End Function
The example displays output lượt thích the following:

.NET Framework Version: 4.6.1

Query the registry using code Power
Shell

The following example uses Power
Shell to check the value of the Release entry in the registry to find the versions of .NET Framework 4.5-4.8.1 that are installed:

$release = Get-Item
Property
Value -Literal
Path "HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Full" -Name Releaseswitch ($release) $_ -ge 533320 $version = "4.8.1 or later"; break $_ -ge 528040 $version = "4.8"; break $_ -ge 461808 $version = "4.7.2"; break $_ -ge 461308 $version = "4.7.1"; break $_ -ge 460798 $version = "4.7"; break $_ -ge 394802 $version = "4.6.2"; break $_ -ge 394254 $version = "4.6.1"; break $_ -ge 393295 $version = "4.6"; break $_ -ge 379893 $version = "4.5.2"; break $_ -ge 378675 $version = "4.5.1"; break $_ -ge 378389 $version = "4.5"; break default $version = $null; break if ($version) Write-Host -Object ".NET Framework Version: $version" else Write-Host -Object ".NET Framework Version 4.5 or later is not detected."This example follows the recommended practice for version checking:

It checks whether the value of the Release entry is greater than or equal to the value of the known release keys.It checks in order from most recent version lớn earliest version.

Detect .NET Framework 1.0 through 4.0

Each version of .NET Framework from 1.1 to 4.0 is listed as a subkey at HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDP. The following table lists the path lớn each .NET Framework version. For most versions, there"s an Install REG_DWORD value of 1 to lớn indicate this version is installed. In these subkeys, there"s also a Version REG_SZ value that contains a version string.


Framework Version
Registry Subkey
Value
1.0HKLMSoftwareMicrosoft.NETFrameworkPolicyv1.03705Install REG_SZ equals 1
1.1HKLMSoftwareMicrosoftNET Framework SetupNDPv1.1.4322Install REG_DWORD equals 1
2.0HKLMSoftwareMicrosoftNET Framework SetupNDPv2.0.50727Install REG_DWORD equals 1
3.0HKLMSoftwareMicrosoftNET Framework SetupNDPv3.0SetupInstall
Success
REG_DWORD equals 1
3.5HKLMSoftwareMicrosoftNET Framework SetupNDPv3.5Install REG_DWORD equals 1
4.0 Client ProfileHKLMSoftwareMicrosoftNET Framework SetupNDPv4ClientInstall REG_DWORD equals 1
4.0 Full ProfileHKLMSoftwareMicrosoftNET Framework SetupNDPv4FullInstall REG_DWORD equals 1

Important

If the app you"re running is 32-bit và running in 64-bit Windows, the registry paths will be different than previously listed. The 64-bit registry is available in the HKEY_LOCAL_MACHINESOFTWAREWow6432Node subkey. For example, the registry subkey for .NET Framework 3.5 is HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftNET Framework SetupNDPv3.5.


Notice that the registry path khổng lồ the .NET Framework 1.0 subkey is different from the others.

Use Registry Editor (older framework versions)

From the Start menu, choose Run, enter regedit, and then select OK.

You must have administrative credentials khổng lồ run regedit.

Query the registry using code (older framework versions)

Use the Microsoft.Win32.Registry
Key class khổng lồ access the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDP subkey in the Windows registry.


Important

If the app you"re running is 32-bit & running in 64-bit Windows, the registry paths will be different than previously listed. The 64-bit registry is available in the HKEY_LOCAL_MACHINESOFTWAREWow6432Node subkey. For example, the registry subkey for .NET Framework 3.5 is HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftNET Framework SetupNDPv3.5.


The following example finds the versions of .NET Framework 1-4 that are installed:

// xuất hiện the registry key for the .NET Framework entry.using (Registry
Key ndp
Key = Registry
Key.Open
Base
Key(Registry
Hive.Local
Machine, Registry
View.Registry32). Open
Sub
Key(
"SOFTWAREMicrosoftNET Framework SetupNDP")) foreach (var version
Key
Name in ndp
Key.Get
Sub
Key
Names()) // Skip .NET Framework 4.5 version information. If (version
Key
Name == "v4") continue; if (version
Key
Name.Starts
With("v")) Registry
Key version
Key = ndp
Key.Open
Sub
Key(version
Key
Name); // Get the .NET Framework version value. Var name = (string)version
Key.Get
Value("Version", ""); // Get the service pack (SP) number. Var sp = version
Key.Get
Value("SP", "").To
String(); // Get the installation flag. Var install = version
Key.Get
Value("Install", "").To
String(); if (string.Is
Null
Or
Empty(install)) // No install info; it must be in a child subkey. Console.Write
Line($"version
Key
Name name"); else if (install == "1") // Install = 1 means the version is installed. If (!string.Is
Null
Or
Empty(sp)) Console.Write
Line($"version
Key
Name name SPsp"); else Console.Write
Line($"version
Key
Name name"); if (!string.Is
Null
Or
Empty(name)) continue; // else print out info from subkeys... // Iterate through the subkeys of the version subkey. Foreach (var sub
Key
Name in version
Key.Get
Sub
Key
Names()) Registry
Key sub
Key = version
Key.Open
Sub
Key(sub
Key
Name); name = (string)sub
Key.Get
Value("Version", ""); if (!string.Is
Null
Or
Empty(name)) sp = sub
Key.Get
Value("SP", "").To
String(); install = sub
Key.Get
Value("Install", "").To
String(); if (string.Is
Null
Or
Empty(install)) // No install info; it must be later. Console.Write
Line($" version
Key
Name name"); else if (install == "1") if (!string.Is
Null
Or
Empty(sp)) Console.Write
Line($" sub
Key
Name name SPsp"); else Console.Write
Line($" sub
Key
Name name"); ' Opens the registry key for the .NET Framework entry.Using ndp
Key As Registry
Key = Registry
Key.Open
Base
Key(Registry
Hive.Local
Machine, Registry
View.Registry32). Open
Sub
Key("SOFTWAREMicrosoftNET Framework SetupNDP") For Each version
Key
Name In ndp
Key.Get
Sub
Key
Names() ' Skip .NET Framework 4.5 and later. If version
Key
Name = "v4" Then Continue For If version
Key
Name.Starts
With("v") Then Dim version
Key As Registry
Key = ndp
Key.Open
Sub
Key(version
Key
Name) ' Get the .NET Framework version value. Dim name = Direct
Cast(version
Key.Get
Value("Version", ""), String) ' Get the service pack (SP) number. Dim sp = version
Key.Get
Value("SP", "").To
String() Dim install = version
Key.Get
Value("Install", "").To
String() If String.Is
Null
Or
Empty(install) Then ' No install info; it must be in a child subkey. Console.Write
Line($"version
Key
Name name") Else
If install = "1" Then If Not String.Is
Null
Or
Empty(sp) Then Console.Write
Line($"version
Key
Name name SPsp") Else Console.Write
Line($"version
Key
Name name") over If over If If Not String.Is
Null
Or
Empty(name) Then Continue For over If For Each sub
Key
Name In version
Key.Get
Sub
Key
Names() Dim sub
Key As Registry
Key = version
Key.Open
Sub
Key(sub
Key
Name) name = Direct
Cast(sub
Key.Get
Value("Version", ""), String) If Not String.Is
Null
Or
Empty(name) Then sp = sub
Key.Get
Value("SP", "").To
String() end If install = sub
Key.Get
Value("Install", "").To
String() If String.Is
Null
Or
Empty(install) Then ' No install info; it must be later. Console.Write
Line($" version
Key
Name name") Else
If install = "1" Then If Not String.Is
Null
Or
Empty(sp) Then Console.Write
Line($" sub
Key
Name name SPsp") Else Console.Write
Line($" sub
Key
Name name") over If kết thúc If Next over If Next
End Using
The example displays output similar khổng lồ the following:

Shell (older framework versions)The following example uses Power
Shell to kiểm tra the value of the Release entry in the registry khổng lồ find the versions of .NET Framework 1-4 that are installed:

Get-Child
Item -Path "HKLM:SOFTWAREMicrosoftNET Framework SetupNDP" |Where-Object ($_.PSChild
Name -ne "v4") -and ($_.PSChild
Name -like "v*") |For
Each-Object $name = $_.Version $sp = $_.SP $install = $_.Install if (-not $install) Write-Host -Object "$($_.PSChild
Name) $($name)" elseif ($install -eq "1") if (-not $sp) Write-Host -Object "$($_.PSChild
Name) $($name)" else Write-Host -Object "$($_.PSChild
Name) $($name) SP$($sp)" if (-not $name) Where-Object if ($_.Property -contains "Version") $name = Get-Item
Property
Value -Path $_.PSPath -Name Version if ($name -and ($_.Property -contains "SP")) $sp = Get-Item
Property
Value -Path $_.PSPath -Name SP if ($_.Property -contains "Install") $install = Get-Item
Property
Value -Path $_.PSPath -Name Install if (-not $install) Write-Host -Object " $($parent
Name) $($name)" elseif ($install -eq "1") if (-not $sp) Write-Host -Object " $($_.PSChild
Name) $($name)" else Write-Host -Object " $($_.PSChild
Name) $($name) SP$($sp)"

Find CLR versions

The .NET Framework CLR installed with .NET Framework is versioned separately. There are two ways lớn detect the version of the .NET Framework CLR:

Nếu bạn cần tò mò phiên bản .NET trên sản phẩm công nghệ tính, trong gợi ý này, Văn phát Đạt vẫn chỉ cho chính mình cách sử dụng trên Windows 10.

Mặc dù, đối với hầu như các phần, bạn không đề xuất phải lo lắng về phiên bạn dạng .NET được cài đặt lên trên Windows 10. Một vài ứng dụng yêu cầu một bạn dạng phát hành ví dụ để chạy. Các lập trình viên thường bắt buộc chạy nhiều phiên bạn dạng của gốc rễ để cải cách và phát triển và thực thi ứng dụng. Và hoàn toàn có thể hiểu rằng, những phiên bạn dạng .NET tất cả sẵn trên máy của chúng ta có thể có ích.

*

Bạn có thể sử dụng 3 cách nhanh nhất có thể để xác định phiên bản .NET Framework bằng Command Prompt, Power
Shell
cùng Registry.

Xem thêm: 3 Cách Xem Pass Wifi Android Không Cần Root Máy, Làm Thế Nào Xem Pass Wifi Android Không Cần Root

Cách kiểm tra phiên bản .NET bằng Command Prompt

Để soát sổ phiên bản .NET Framework được cài bỏ trên Windows 10, hãy làm các bước sau:

Mở Start.

Tìm kiếm Command Prompt, bấm vào phải vào tác dụng trên cùng. Lựa chọn tùy lựa chọn Run as administrator.

Nhập lệnh sau để xác định phiên bản .NETđã cài đặt và nhấn Enter:reg query “HKLMSOFTWAREMicrosoftNet Framework SetupNDP” /s

Nếu bạn muốn đảm bảo rằng phiên phiên bản 4.x đang được cài đặt, thì nên sử dụng phát triển thành thể của lệnh này:reg query “HKLMSOFTWAREMicrosoftNet Framework SetupNDPv4” /sKiểm tra trường Version để chứng thực các bản phát hành của .NET Framework có sẵn trên Windows 10.

Khi bạn xong các bước, bạn sẽ biết những phiên bản .NET đang làm việc trên lắp thêm của mình.

*

Cách kiểm soát phiên bản .NET bởi Registry

Để xác minh phiên bản .NET cùng với Registry, hãy làm các bước sau:

Mở Start.

Tìm kiếm regedit và nhấp vào kết quả trên cùng để mở Registry.

Duyệt qua đường truyền sau:HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDP

Mẹo nhanh: Trên Windows 10, tiếng đây bạn có thể sao chép cùng dán đường đưa vào thanh địa chỉ của Registry để nhanh chóng chuyển mang lại đích chính.

Chọn key phiên bạn dạng chính. Ví dụ: v4 hoặc v4.0.

Chọn Client key.

Mẹo nhanh: Trong các bạn dạng phát hành cũ rộng phiên phiên bản 4, key đang là số hoặc Setup. Ví dụ: .NET phiên bạn dạng 3.5 bao có số phiên phiên bản dưới phím 1033.

Ở mặt phải, chất vấn chuỗi Version để xác thực việc vạc hành .NET Framework.

Sau lúc bạn hoàn thành các bước, bạn sẽ hiểu về bài toán phát hành khung Microsoft gồm sẵn trên Windows 10.

*

Cách đánh giá phiên bạn dạng .NET bằng Power
Shell

Nếu chúng ta sử dụng Power
Shell
, chúng ta có nhiều phương pháp để xác minh các phiên bản .NET Framework được cài đặt trên Windows 10, bao gồm chế tạo ra lệnh hoặc thiết lập công cụ cái lệnh.

Kiểm tra phiên bản lệnh tùy chỉnh

Để sử dụng Power
Shell đánh giá phiên bản .NET, hãy làm các bước sau:

Mở Start.

Tìm kiếm Power
Shell
, nhấn vào phải vào tác dụng trên cùng và lựa chọn tùy chọn Run as administrator.

Nhập lệnh sau để khẳng định phiên bản .NET đã cài đặt và nhấn Enter:Get-Child
Item ‘HKLM:SOFTWAREMicrosoftNET Framework SetupNDP’ -Recurse | Get-Item
Property -Name version -EA 0 | Where $_.PSChild
Name -Match ‘^(?!S)pL’ | Select PSChild
Name, version

Xác nhận các phiên bản phát hành của.NET Framework được cài đặt lên Windows 10.

Khi bạn dứt các bước, cổng output sẽ bật mý thông tin cho cả máy khách và phiên bản .NET đầy đủ được cài đặt lên trên thiết bị của khách hàng (nếu có).

*

Kiểm tra phiên bản Dot
Net
Version
Lister

Ngoài ra, gồm một công cụ cộng đồng tại Git
Hub giúp bạn dễ dàng truy vấn danh sách các phiên bản .NET đã cài để lên trên máy tính của bạn.

Để tò mò danh sách những phiên bản .NET được cài bỏ lên Windows 10, hãy làm quá trình sau:

*

Mở Start.

Tìm kiếm Power
Shell
, nhấn vào phải vào kết quả trên thuộc và chọn tùy chọn Run as administrator.

Nhập lệnh sau để thiết lập mô-đun cần thiết và nhận Enter:Install-Module -Name Dot
Net
Version
Lister -Scope Current
User #-Force

Cài đặt Dotnetversionlister trên Windows 10.

Gõ Y và nhấn Enter.

Gõ Y và nhấn Enter lần nữa.

Nhập lệnh sau để khẳng định phiên bản .NET đã cài đặt và nhấn Enter :Get-STDot
Net
Version

Sau khi bạn ngừng các bước, bạn sẽ kết thúc với 1 đầu ra cho chính mình biết các phiên bạn dạng .NET được cài đặt lên trên Windows 10.

*

Bài viết này tập trung hướng dẫn thao tác trên Windows 10. Nhưng bạn có thể tham khảo quá trình này nếu như bạn đang làm việc phiên bạn dạng cũ rộng của hệ điều hành, bao gồm Windows 8.1 hoặc Windows 7.

☞ có thể bạn quan liêu tâm