Fork me on GitHub

部署Microsoft .NET Framework 3.0[翻译]

une2006

适用

Microsoft .NET Framework 3.0(以前叫做WinFX)
Microsoft .NET Framework 2.0
Microsoft Windows Vista

英文原文 :http://msdn.microsoft.com/winfx/default.aspx?pull=/library/en-us/dnlong/html/netfx30.asp

摘要:

 Microsoft .NET Framework 3.0(以前叫做WinFX),是托管代码的Windows编程模型。使用.NET Framework 3.0编写的应用程序要求运行的电脑上安装Microsoft .NET Framework 3.0。本文简要说明Microsoft .NET Framework 3.0和以前版本的关系。提供安装和部署的信息并且描述了如何检测是否安装了Microsoft .NET Framework 3.0

内容:

介绍

  关于Microsoft .NET Framework 3.0

  Microsoft .NET Framework 3.0和早期版本的关系

  Microsoft .NET Framework 3.0的服务策略

  Microsoft .NET Framework 的未来路线图

安装Microsoft .NET Framework 3.0

  .NET Framework 程序集的版本号

部署Microsoft .NET Framework 3.0

  软件需求

  硬件需求

  再分发Microsoft .NET Framework 的权利

  Microsoft .NET Framework 3.0部署工具

  在你的程序中分发Microsoft .NET Framework 3.0

检测Microsoft .NET Framework 3.0和早期版本

  读取注册表键值

  IE 浏览器读取的User-agent 字符串

Microsoft .NET Framework 3.0分发的命令行选项

分发Microsoft .NET Framework 3.0的错误代码

附录1:分发Microsoft .NET Framework语言包

附录2:使用IE浏览器检测Microsoft .NET Framework 3.0的脚本 

 

介绍

   本节概述了Microsoft .NET Framework 3.0

关于Microsoft .NET Framework 3.0

   Microsoft .NET Framework 3.0(以前叫做WinFX),是托管代码的Windows编程模型。它包含了Microsoft .NET Framework 2.0,提供了构建更好用户体验和天衣无缝的沟通并支持广泛业务过程的新技术。微软计划将.NET Framework 3.0作为Windows Vista的一部分发布。同时.NET Framework 3.0 支持Windows XP Service Pack 2 Windows Server 2003 Service Pack 1

下表中列出.NET Framework 3.0技术特性

技术

说明

Windows Presentation Foundation (WPF,以前代码叫“Avalon)

提供了构建新一代的智能客户端所需要的UI,文档以及媒体

Windows Communication Foundation (WCF, 以前代号叫做 "Indigo")

为构建面向服务的应用程序提供了一个统一的编程模型和运行时

Windows Workflow Foundation (WF)

为工作流驱动业务流程的应用提供了编程模型,引擎和工具。

Windows CardSpace (以前代号叫做 "InfoCard")

提供了一种简化和改进安全的在线个人标识技术

Microsoft .NET Framework 2.0

构建WindowsWeb应用

代表新组件(WPF, WF, WCF以及CardSpace)的所有类都是System命名空间的一部分。.NET 平台的核心类,例如公共语言运行时(CLR)和基础类库(BCL)还是在.NET Framework 2.0中。

下图说明了.NET Framework 3.0的结构



1 .NET Framework 3.0 

 

 

Microsoft .NET Framework 3.0和早期版本的关系

  .NET Framework 3.0是在.NET Framework 2.0上添加了新的技术,这使得.NET Framework 3.0.NET Framework 2.0的一个超集,你可能想到的.NET Framework 3.0.NET Framework 2.0的添加剂。可以认为是一个以发行软件的一个全面修订(例如 .NET Framework 2.0是在.NET Framework 1.0之后发布)。

 由于.NET Framework 3.0.NET Framework 2.0的附加版本并使用.NET Framework 2.0的核心组件,它也是完全符合先后关系。使用.NET Framework 2.0构建的应用程序并不需要做任何修改就可以运行在.NET Framework 3.0上,你可以放心的继续投资用.NET Framework 2.0构建应用程序。

如果你是从.NET Framework 1.0或者1.1移植到.NET Framework 3.0。应当在部署之前做应用的影响分析和兼容性测试。我们为.NET Framework版本的兼容性作了大量的工作。由于有一些附加的的功能性和安全性原因有一些已知的不相容的地方。更多的信息,请参看微软.NET开发中心网站Breaking Changes in .NET Framework 2.0

 

Microsoft .NET Framework 3.0的服务策略

  微软继续按照.NET Framework 2.0发布的政策支持平台。用户目前所用的.NET Framework 2.0可以继续保留,当新版本可以的时候就可以获得最新的软件。随.NET Framework 3.0发布的任何组件都可以获得平台的支持。更多的信息请参看微软的Visual Studio 开发者中心网站的Software Update Technology

 

Microsoft .NET Framework 的未来路线图

  一般.NET Framework的新版本都会提供与先前版本兼容,如果由于安全问题或者其他的原因在新的版本中打破,微软将使你和现行版本一起安装

。关于新版本的更多的信息,请参看微软.NET Framework开发中心网站Microsoft .NET Framework Developer Center

 

安装 .NET Framework 3.0

.NET Framework 3.0作为Windows Vista的一部分安装。在代号为“Longhorn Windows服务器,你可以使用管理工具来安装.NET Framework 3.0。在Windows XPWindows Server 2003和安装.NET Framework 2.0一样安装.NET Framework 3.0。如果你已经安装了.NET Framework 2.0,你只需要安装Windows Presentation Foundation (WPF), Windows Workflow Foundation (WF), Windows Communication Foundation (WCF), Windows CardSpace需要的文件。

.NET Framework 2.0的组件安装在如下的位置

%WINDIR%\Microsoft.NET\Framework\v2.0.50727

  新的.NET Framework 3.0的组件安装在新的位置

%WINDIR%\Microsoft.NET\ Framework \v3.0

  所有的.NET Framework 3.0引用的程序集安装在下面的位置

%programfiles%\Reference Assemblies\Microsoft\Framework\v3.0

卸载.NET Framework 3.0不会卸载.NET Framework 2.0的公共组件,要卸载这些组件,你必须先卸载.NET Framework 3.0然后卸载.NET Framework 2.0(可以通过控制面板的添加/删除应用程序来卸载.NET Framework).

 

.NET Framework 程序集的版本号

 .NET Framework 3.0.NET Framework 2.0使用许多相同的组件,公共语言运行时(CLR)和基础类库(BCL)都是和.NET Framework 2.0一样的。所以这些组件的版本号还是2.0的。Windows Presentation Foundation (WPF), Windows Workflow Foundation (WF), Windows Communication Foundation (WCF), Windows CardSpace的运行和的引用的程序集是3.0

 

部署.NET Framework 3.0

  本节提供了如何在你的应用程序中部署.NET Framework 3.0的信息

软件要求

  要安装.NET Framework 3.0,必须在你的计算机上安装以下操作系统:

n        打了Service Pack 2 以上Microsoft Windows XP Home 或者Microsoft Windows XP Home Professional.

n        打了Service Pack 1 以上的Microsoft Windows Server 2003 family.

  说明:.NET Framework 2.0仍然在他的目标平台上得到支持的,更多的信息请参看MSDN网站的.NET Framework 2.0 Redistributable Prerequisites

Microsoft Windows Vista上默认安装了.NET Framework 3.0.Microsoft Windows Server “Longhorn”,可以通过管理工具安装。

 

说明:Microsoft Windows Server “Longhorn” IA64版本是唯一支持.NET Framework 3.0的平台

硬件要求:

 下面列表中是安装.NET Framework 3.0的硬件要求

 

CPU要求

内存要求

最低

奔腾400 MHz

96 M

推荐

Pentium 1 GHz以上

256M以上

 

再分发Microsoft .NET Framework 的权利

  微软强烈推荐用户部署.NET Framework 3.0到组织内,作为自己的软件解决方案,分发.NET Framework 3.0要求你接受.NET Framework 3.0的许可证。在你的程序中将.NET Framework 3.0作为第三方组件进行分发的更多,参看MSDN网站的页面The ISV Guide for Redistributing the .NET Framework and Other Runtime Components

 

  说明 再分发的保留权利是指微软发布.NET Framework 3.0,如果你的程序使用的是.NET Framework3.0,你不需要重新分发微软的.NET Framework 3.0之前的版本。

 

Microsoft .NET Framework 3.0部署工具

.NET Framework 3.0为系统管理员提供了两种方式部署到客户端:管理员模式安装和通过活动目录部署。

管理员模式安装

管理员安装模式使得管理员可以通过网络服务器(SMS)或者其他的软件分发工具。管理员通过工具自动安装程序,如果发生错误,安装程序会自动退出并记录错误代码。

活动目录分发

  活动目录模式下,管理员必须在组策略中设定.NET Framework 3.0的安装包(.msi文件)将要安装到的位置。然后启用组策略。任何在这个组策略中的客户点将会它们启动并连接到网络的时候自动安装,如果发生错误,安装程序会自动退出并记录错误代码。

 

在你的程序中分发Microsoft .NET Framework 3.0

  .NET Framework 3.0在分发程序包是一个可单独运行的可执行文件,它的名字和他的目标平台相关,例如:32位的平台上,名字叫做Dotnetfx3.exe

.64位平台上的名字叫做Dotnetfx3_x64.exe.你也可以分发一个更小的分发包叫做Dotnet3setup.exe,它只是下载了安装期间必须的组件。

当你在你的程序中再分发.NET Framework 3.0,你必须同意许可证,这是你的分发权利。

  你可以手工安装.NET Framework 3.0到你的计算机,或者作为安装程序的一部分在安装.NET Framework 3.0的应用程序的时候安装。

  说明 在安装.NET Framework 3.0的时候要求有系统管理员权限

 

检测Microsoft .NET Framework 3.0和早期版本

 你可以通过读注册表和在浏览器中通过脚本来检测是否安装了.NET Framework 3.0

 

读注册表

  通过一个指定的注册表值来检测.NET Framework是否在机器上安装,下面列出各个版本的.NET Framework的注册表值

版本

注册表键

3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup

InstallSuccess (DWORD value = 1)

2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727

Install (DWORD value = 1)

1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322

Install (DWORD value = 1)

1.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v1.0

Install (DWORD value = 1)

 

 说明:关于检测版本1.01.1的补丁包的更详细信息参考微软知识库中文章318785, "How to determine which versions of the .NET Framework are installed and whether service packs have been applied"

 

IE 浏览器读取的User-agent 字符串

Web应用程序, 可以通过检测计算机上所运行的IE浏览器来判断是否在机器上安装了.NET Framework 3.0.  user-agent 字符串中会包含"NET CLR" 的版本号. user-agent 像下面这样:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; 
.NET CLR 2.0.50727; .NET CLR 3.0.04131.06)

附录B: 使用IE浏览器检测Microsoft .NET Framework 3.0的脚本列举了一个使用JavaScript脚本检测当前的.NET Framework 版本号的例子。浏览器的头部的User-agent 字符串存储在服务器的注册表中。下表列出各个版本版本号的 注册表键值

版本

注册表键值

3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform\.NET CLR.3.0.04131.06

Note   The build number (04131.06 in the example) will change for the final release of .NET Framework 3.0.

2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform\.NET CLR 2.0.50727

1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform\.NET CLR 1.1.4322

再分发the .NET Framework 3.0 的命令行参数

下表中列出从命令行中运行.NET Framework 3.0的再分发安装程序 (Dotnetfx3.exe, Dotnetfx3_x64.exe, or Dotnet3setup.exe) 的命令行参数

参数

描述

/q

Suppresses all UI. An .INI file cannot be specified with this option.

/quiet

Same as /q.

/qb

Displays minimal UI, showing only progress.

/passive

Same as /qb.

/uninstall

Uninstalls product.

/remove

Same as /uninstall.

/f

Repairs all .NET Framework 3.0 components that are installed.

/nopatch

Specifies that patches are not applied and bypasses patch checking.

/norollback

Specifies that setup is not rolled back if a setup component fails.

/norestart

Specifies that the installer does not restart the computer after installation completes. The Redistributable installer returns ERROR_SUCCESS_REBOOT_REQUIRED (3010) if a reboot is required.

/?

Displays this list of options.

Error Codes for the .NET Framework 3.0 Redistributable

The following table lists error codes that can be returned by the .NET Framework 3.0 Redistributable installation program (Dotnetfx3.exe, Dotnetfx3_x64.exe, or Dotnet3setup.exe). The error codes are the same for all versions of the installer.

Error Code

Value

Description

ERROR_SUCCESS

0

The action completed successfully.

ERROR_INSTALL_USEREXIT

1602

User canceled installation.

ERROR_INSTALL_FAILURE

1603

A fatal error occurred during installation.

ERROR_UNKNOWN_PRODUCT

1605

This action is valid only for products that are currently installed.

ERROR_PATCH_PACKAGE_INVALID

1636

The patch package could not be opened or the patch was not applicable to .NET Framework 3.0.

ERROR_INVALID_COMMAND_LINE

1639

Invalid command line argument.

ERROR_SUCCESS_REBOOT_INITIATED

1641

The installer has initiated a restart. This indicates success, and setup will continue after restart. (The reboot is not performed if the /norestart option was specified.)

ERROR_PATCH_PACKAGE_REJECTED

1643

The patch package is not permitted by system policy.

ERROR_SUCCESS_REBOOT_REQUIRED

3010

A restart is required to complete the installation. This message indicates success.

Appendix A: Detecting .NET Framework Language Packs

The following table lists the registry values you can read to detect whether a .NET Framework language pack is installed on a computer. For more information on how to detect localized version of the .NET Framework 1.0, see the page .NET Framework Redistributable Package Technical Reference on the MSDN Web site.

Product

Registry Value

Chinese (Simplified) Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\2052

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\2052

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\2052

InstallSuccess(DWORD value = 1)

Chinese (Traditional) Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1028

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1028

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1028

InstallSuccess(DWORD value = 1)

Czech Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1029

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1029

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1029

InstallSuccess(DWORD value = 1)

Danish Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1030

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1030

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1030

InstallSuccess(DWORD value = 1)

Dutch Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1043

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1043

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1043

InstallSuccess(DWORD value = 1)

Finnish Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1035

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1035

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1035

InstallSuccess(DWORD value = 1)

French Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1036

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1036

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1036

InstallSuccess (DWORD value = 1)

German Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1031

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1031

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1031

InstallSuccess(DWORD value = 1)

Greek Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1032

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1032

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1032

InstallSuccess(DWORD value = 1)

Italian Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1040

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1040

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1040

InstallSuccess(DWORD value = 1)

Japanese Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1041

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1041

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1041

InstallSuccess(DWORD value = 1)

Korean Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1042

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1042

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1042

InstallSuccess(DWORD value = 1)

Norwegian Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1044

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1044

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1044

InstallSuccess(DWORD value = 1)

Polish Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1045

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1045

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1045

InstallSuccess(DWORD value = 1)

Portuguese (Brazilian) Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1046

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1046

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1046

InstallSuccess(DWORD value = 1)

Portuguese (Portugal) Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\2070

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\2070

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\2070

InstallSuccess(DWORD value = 1)

Russian Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1049

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1049

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1049

InstallSuccess(DWORD value = 1)

Spanish Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\3082

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\3082

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\3082

InstallSuccess(DWORD value = 1)

Swedish Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1053

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1053

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1053

InstallSuccess(DWORD value = 1)

Turkish Language Pack

Version 1.1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322\1055

Version 2.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\1055

Install (DWORD value = 1)

Version 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\1055

InstallSuccess(DWORD value = 1)

Appendix B: Sample Script for Detecting the .NET Framework 3.0 Using Internet Explorer

The following example shows a JavaScript program that runs in a browser detects whether .NET Framework 3.0 is running. The script searches the user-agent string and displays a status message based on the results of the search.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Test for NET Framework 3.0</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <script type="text/javascript" language="JavaScript">
    <!--
    var RequiredFXVersion = "3.0.04131.06";
    
    function window::onload()
    {
      var foundVer = CheckRequiredFXVersion(RequiredFXVersion);
      if (foundVer != null)
      {
        result.innerHTML = "This computer has the correct version of the .NET Framework: " + foundVer + "." + "<br/>"
          + "This computer's userAgent string is: " + navigator.userAgent + ".";
      } 
      else
      {
        result.innerHTML = "This computer does not have the correct version of the .NET Framework.<br/>"
          + "<a href='http://msdn.microsoft.com/windowsvista/default.aspx'>Click here</a> "
          + "to get .NET Framework 3.0 now.<br>"
          + "This computer's userAgent string is: " + navigator.userAgent + ".";
      }
    }
    
    //
    // Retrieve available versions from the user agent string
    // and check if any of them match the required version.
    //
    function CheckRequiredFXVersion(requiredVersion)
    {
      var userAgentString = navigator.userAgent.match(/\.NET CLR[ .][0-9.]+/g);
      if (userAgentString != null)
      {
        var i;
        for (i = 0; i < userAgentString.length; ++i)
        {
          var ver = userAgentString[i].slice(9);
          if (CheckVersion(requiredVersion, ver))
            return ver;
        }
      }
      return null;
    }
 
    //
    // Check if a specific version satisfies the version requirement.
    //
    function CheckVersion(requiredVersion, ver)
    {
      requiredVersion = requiredVersion.split(".");
      ver = ver.split(".");
      
      // Major versions must match exactly.
      if (requiredVersion[0] != ver[0])
        return false;
      
      // Minor/build numbers must be at least the required version.
      var i;
      for (i = 1; i < requiredVersion.length && i < ver.length; i++)
      {
        if (new Number(ver[i]) < new Number(requiredVersion[i]))
          return false;
      }
      return true;
    }
    
    -->
    </script>
  </head>
  <body>
    <div id="result" />
  </body>
</html>

If the search for the string ".NET Framework 3.0" version is successful, the following message appears:

This computer has the correct version of the .NET Framework: 3.0.04131.06.

This computer's userAgent string is: Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04131.06).

Otherwise, the following message appears:

This computer does not have the correct version of the .NET Framework.

Click here to get .NET Framework 3.0 now.

This computer's userAgent string is: Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727).

posted @ 2006-07-01 10:51  张善友  阅读(7068)  评论(4编辑  收藏  举报