如何检测.NET Framework版本和Service Pack安装了哪些?版本、安装了、Framework、NET

2023-09-02 01:16:26 作者:梨花泪

有一个类似的问题被问这里,但它是专门针对.NET 3.5。具体而言,我正在寻找以下:

什么是正确的方式来确定安装了哪些版本的.NET Framework和服务包? 有注册表项的可以使用一个列表? 是否有框架版本之间有任何相关性? 解决方案

注册表是的正式的方式,以检测是否安装了框架的特定版本。

哪些注册表项需要改变取决于你正在寻找Framework版本:

Framework版本注册表项
-------------------------------------------------- ----------------------------------------
1.0 HKLM 软件微软 .NETFramework 策略 1.0  3705
1.1 HKLM 软件微软 NET Framework安装新民主党 V1.1.4322 安装
2.0 HKLM 软件微软 NET Framework安装新民主党 V2.0.50727 安装
3.0 HKLM 软件微软 NET Framework安装新民主党 3.0  SETUP  InstallSuccess
3.5 HKLM 软件微软 NET Framework安装新民主党器v3.5 安装
4.0客户端配置文件HKLM 软件微软 NET Framework安装新民主党 V4 客户端安装
4.0全部档案HKLM 软件微软 NET Framework安装新民主党 V4 全安装

通常你正在寻找的:

 安装= DWORD:00000001
 
在Win10系统中查看.Net FrameWork版本号的步骤

除了.NET 1.0,其中的值是一个字符串( REG_SZ ),而不是一个数字( REG_DWORD )。

确定服务包级别遵循类似的模式:

Framework版本注册表项
-------------------------------------------------- ----------------------------------------
1.0 HKLM 软件微软 Active安装安装的组件 {78705f0d-e8db-4b2d-8193-982bdda15ecd} 版本
1.0 [1] HKLM 软件微软 Active安装安装的组件 {FDC11A6F-17D1-48f9-9EA3-9051954BAA24} 版本
1.1 HKLM 软件微软 NET Framework安装新民主党 V1.1.4322  SP
2.0 HKLM 软件微软 NET Framework安装新民主党 V2.0.50727  SP
3.0 HKLM 软件微软 NET Framework安装新民主党 3.0  SP
3.5 HKLM 软件微软 NET Framework安装新民主党器v3.5  SP
4.0客户端配置文件HKLM 软件微软 NET Framework安装新民主党 V4 客户端维修
4.0全部档案HKLM 软件微软 NET Framework安装新民主党 V4 完全维修

[1]的Windows Media Center或Windows XP平板电脑版

正如你所看到的,如果是在Windows媒体中心或Windows XP Tablet Edition的运行确定SP级别.NET 1.0的变化。此外,.NET 1.0中使用一个字符串值,而所有其他人都使用一个DWORD。

有关.NET 1.0在其中任何一个键的字符串值有#的格式,#####,#。最后一个#是Service Pack级别。

虽然我没有明确要求这一点,如果你想知道的框架,你会使用这些注册表项的具体版本号:

Framework版本注册表项
-------------------------------------------------- ----------------------------------------
1.0 HKLM 软件微软 Active安装安装的组件 {78705f0d-e8db-4b2d-8193-982bdda15ecd} 版本
1.0 [1] HKLM 软件微软 Active安装安装的组件 {FDC11A6F-17D1-48f9-9EA3-9051954BAA24} 版本
1.1 HKLM 软件微软 NET Framework安装新民主党 V1.1.4322
2.0 [2] HKLM 软件微软 NET Framework安装新民主党 V2.0.50727 版本
2.0 [3] HKLM 软件微软 NET Framework安装新民主党 V2.0.50727 增量
3.0 HKLM 软件微软 NET Framework安装新民主党 3.0 版本
3.5 HKLM 软件微软 NET Framework安装新民主党器v3.5 版本
4.0客户端配置文件HKLM 软件微软 NET Framework安装新民主党 V4 版本
4.0全部档案HKLM 软件微软 NET Framework安装新民主党 V4 版本

[1]的Windows Media Center或Windows XP平板电脑版
[2] .NET 2.0 SP1
[3] .NET 2.0原始发布(RTM)

此外,.NET 1.0中使用一个字符串值,而所有其他人都使用一个DWORD。

其他注意事项

有关.NET 1.0的字符串值,在其中任何一个键都有#,#的格式,####,#。该#,#,字符串#### 部分是Framework版本。

有关.NET 1.1中,我们使用的注册表项本身,从而重新presents版本号的名字。

最后,如果你的依赖,.NET 3.0增加了更多的功能,所以无论.NET 2.0和.NET 3.0都必须evaulate为被安装到正确的说,.NET 3.0安装.NET 2.0。同样,.NET 3.5增加了.NET 2.0和.NET 3.0,所以.NET 2.0,.NET 3.0和.NET 3,都应该计算为被安装到正确的说,.NET 3.5的安装额外的功能。

.NET 4.0安装的CLR(CLR版本4.0),它可以运行并排侧CLR 2.0的新版本。

更新.NET 4.5

不会有一个 V4.5 键,如果.NET 4.5被安装在注册表中。相反,你必须检查 HKLM 软件微软 NET Framework安装新民主党 V4 全部键包含一个名为释放值。如果这个值是present,.NET 4.5安装,否则就不是。更多细节,可以发现这里和的这里。

A similar question was asked here, but it was specific to .NET 3.5. Specifically, I'm looking for the following:

What is the correct way to determine which .NET Framework versions and service packs are installed? Is there a list of registry keys that can be used? Are there any dependencies between Framework versions?

解决方案

The registry is the official way to detect if a specific version of the Framework is installed.

Which registry keys are needed change depending on the Framework version you are looking for:

Framework Version  Registry Key
------------------------------------------------------------------------------------------
1.0                HKLMSoftwareMicrosoft.NETFrameworkPolicyv1.03705 
1.1                HKLMSoftwareMicrosoftNET Framework SetupNDPv1.1.4322Install 
2.0                HKLMSoftwareMicrosoftNET Framework SetupNDPv2.0.50727Install 
3.0                HKLMSoftwareMicrosoftNET Framework SetupNDPv3.0SetupInstallSuccess 
3.5                HKLMSoftwareMicrosoftNET Framework SetupNDPv3.5Install 
4.0 Client Profile HKLMSoftwareMicrosoftNET Framework SetupNDPv4ClientInstall
4.0 Full Profile   HKLMSoftwareMicrosoftNET Framework SetupNDPv4FullInstall

Generally you are looking for:

"Install"=dword:00000001

except for .NET 1.0, where the value is a string (REG_SZ) rather than a number (REG_DWORD).

Determining the service pack level follows a similar pattern:

Framework Version  Registry Key
------------------------------------------------------------------------------------------
1.0                HKLMSoftwareMicrosoftActive SetupInstalled Components{78705f0d-e8db-4b2d-8193-982bdda15ecd}Version 
1.0[1]             HKLMSoftwareMicrosoftActive SetupInstalled Components{FDC11A6F-17D1-48f9-9EA3-9051954BAA24}Version 
1.1                HKLMSoftwareMicrosoftNET Framework SetupNDPv1.1.4322SP 
2.0                HKLMSoftwareMicrosoftNET Framework SetupNDPv2.0.50727SP 
3.0                HKLMSoftwareMicrosoftNET Framework SetupNDPv3.0SP 
3.5                HKLMSoftwareMicrosoftNET Framework SetupNDPv3.5SP 
4.0 Client Profile HKLMSoftwareMicrosoftNET Framework SetupNDPv4ClientServicing
4.0 Full Profile   HKLMSoftwareMicrosoftNET Framework SetupNDPv4FullServicing

[1] Windows Media Center or Windows XP Tablet Edition

As you can see, determining the SP level for .NET 1.0 changes if you are running on Windows Media Center or Windows XP Tablet Edition. Again, .NET 1.0 uses a string value while all of the others use a DWORD.

For .NET 1.0 the string value at either of these keys has a format of #,#,####,#. The last # is the Service Pack level.

While I didn't explicitly ask for this, if you want to know the exact version number of the Framework you would use these registry keys:

Framework Version  Registry Key
------------------------------------------------------------------------------------------
1.0                HKLMSoftwareMicrosoftActive SetupInstalled Components{78705f0d-e8db-4b2d-8193-982bdda15ecd}Version 
1.0[1]             HKLMSoftwareMicrosoftActive SetupInstalled Components{FDC11A6F-17D1-48f9-9EA3-9051954BAA24}Version 
1.1                HKLMSoftwareMicrosoftNET Framework SetupNDPv1.1.4322 
2.0[2]             HKLMSoftwareMicrosoftNET Framework SetupNDPv2.0.50727Version 
2.0[3]             HKLMSoftwareMicrosoftNET Framework SetupNDPv2.0.50727Increment
3.0                HKLMSoftwareMicrosoftNET Framework SetupNDPv3.0Version 
3.5                HKLMSoftwareMicrosoftNET Framework SetupNDPv3.5Version 
4.0 Client Profile HKLMSoftwareMicrosoftNET Framework SetupNDPv4Version 
4.0 Full Profile   HKLMSoftwareMicrosoftNET Framework SetupNDPv4Version 

[1] Windows Media Center or Windows XP Tablet Edition
[2] .NET 2.0 SP1
[3] .NET 2.0 Original Release (RTM)

Again, .NET 1.0 uses a string value while all of the others use a DWORD.

Additional Notes

for .NET 1.0 the string value at either of these keys has a format of #,#,####,#. The #,#,#### portion of the string is the Framework version.

for .NET 1.1, we use the name of the registry key itself, which represents the version number.

Finally, if you look at dependencies, .NET 3.0 adds additional functionality to .NET 2.0 so both .NET 2.0 and .NET 3.0 must both evaulate as being installed to correctly say that .NET 3.0 is installed. Likewise, .NET 3.5 adds additional functionality to .NET 2.0 and .NET 3.0, so .NET 2.0, .NET 3.0, and .NET 3. should all evaluate to being installed to correctly say that .NET 3.5 is installed.

.NET 4.0 installs a new version of the CLR (CLR version 4.0) which can run side-by-side with CLR 2.0.

Update for .NET 4.5

There won't be a v4.5 key in the registry if .NET 4.5 is installed. Instead you have to check if the HKLMSoftwareMicrosoftNET Framework SetupNDPv4Full key contains a value called Release. If this value is present, .NET 4.5 is installed, otherwise it is not. More details can be found here and here.