如何检测.NET Framework版本和Service Pack安装了哪些? [英] How to detect what .NET Framework versions and service packs are installed?

查看:286
本文介绍了如何检测.NET Framework版本和Service Pack安装了哪些?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

哪些注册表项需要改变取决于你正在寻找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
 

除了.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:

  1. What is the correct way to determine which .NET Framework versions and service packs are installed?
  2. Is there a list of registry keys that can be used?
  3. 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                HKLM\Software\Microsoft\.NETFramework\Policy\v1.0\3705 
1.1                HKLM\Software\Microsoft\NET Framework Setup\NDP\v1.1.4322\Install 
2.0                HKLM\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727\Install 
3.0                HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.0\Setup\InstallSuccess 
3.5                HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5\Install 
4.0 Client Profile HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client\Install
4.0 Full Profile   HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full\Install

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                HKLM\Software\Microsoft\Active Setup\Installed Components\{78705f0d-e8db-4b2d-8193-982bdda15ecd}\Version 
1.0[1]             HKLM\Software\Microsoft\Active Setup\Installed Components\{FDC11A6F-17D1-48f9-9EA3-9051954BAA24}\Version 
1.1                HKLM\Software\Microsoft\NET Framework Setup\NDP\v1.1.4322\SP 
2.0                HKLM\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727\SP 
3.0                HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.0\SP 
3.5                HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5\SP 
4.0 Client Profile HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client\Servicing
4.0 Full Profile   HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full\Servicing

[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                HKLM\Software\Microsoft\Active Setup\Installed Components\{78705f0d-e8db-4b2d-8193-982bdda15ecd}\Version 
1.0[1]             HKLM\Software\Microsoft\Active Setup\Installed Components\{FDC11A6F-17D1-48f9-9EA3-9051954BAA24}\Version 
1.1                HKLM\Software\Microsoft\NET Framework Setup\NDP\v1.1.4322 
2.0[2]             HKLM\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727\Version 
2.0[3]             HKLM\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727\Increment
3.0                HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.0\Version 
3.5                HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5\Version 
4.0 Client Profile HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Version 
4.0 Full Profile   HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Version 

[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 HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full 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.

这篇关于如何检测.NET Framework版本和Service Pack安装了哪些?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆