Dela via


Microsoft .NET Framework 3.0 Deployment Guide

 

Microsoft Corporation

July 2006

Contents

Summary
Introduction
Installation Requirements
   Software Requirements
   Hardware Requirements
Where to Obtain the .NET Framework 3.0 Redistributable Package
Redistributing .NET Framework 3.0 Using a Visual Studio 2005 Setup Project
Having Users Install the .NET Framework Manually
Chaining the Redistributable Package in Your Application Setup
Redistributing .NET Framework 3.0 for Web Applications
Detecting Microsoft .NET Framework 3.0
   Reading Registry Keys
   Reading the User-agent String in Internet Explorer
Command-line Options for the .NET Framework 3.0 Redistributable
Error Codes for the .NET Framework 3.0 Redistributable

Summary

This article describes how to deploy Microsoft .NET Framework 3.0 applications with Dotnetfx3.exe, the .NET Framework 3.0 redistributable package. (10 printed pages)

Note   This documentation may include information for scenarios that discuss distribution, but the documentation does not grant to you any rights to use or distribute any part of the Components. Your use of the Components is subject to the license agreement for the Components. Please review the Components license agreement to understand your rights and the conditions of use.

Introduction

The Microsoft.NET Framework 3.0 provides a redistributable installer that contains .NET Framework 2.0 bindings to the required Windows Vista APIs to run .NET Framework 3.0 applications.

The .NET Framework 3.0 redistributable package is available as a stand-alone executable file. The name of the file depends on the type of the targeted platform. For 32-bit platforms, the file is named Dotnetfx3.exe. For 64-bit platforms, the file is named Dotnetfx3_x64.exe. You can also deploy a small redistributable package named Dotnet3setup.exe that downloads the required components during setup.

Note   IA64 support in .NET Framework 3.0 is limited to Microsoft Windows Server code-named "Longhorn." Longhorn already includes .NET Framework 3.0, so no redistributable package is necessary.

You can manually launch and install the redistributable on a computer, or it can be launched and installed as part of the setup program for a .NET Framework 3.0 application.

Note   Administrator privileges are required to install the .NET Framework 3.0.

Installation Requirements

This section describes the software and hardware requirements for a computer where the Microsoft .NET Framework 3.0 redistributable package is to be installed. If the minimum requirements are not met, Dotnetfx3.exe will block the installation of the redistributable package.

Software Requirements

To install Microsoft .NET Framework 3.0, one of the following operating systems must be installed on the target computer:

  • Microsoft Windows XP Home or Microsoft Windows XP Professional, both with Service Pack 2 or later.
  • Microsoft Windows Server 2003 family with Service Pack 1 or later.

For Microsoft Windows Vista (not including the IA64 platform) and Microsoft Windows Server code-named "Longhorn" IA64 Edition, .NET Framework 3.0 is a feature of the operating system.

Hardware Requirements

The following table lists the hardware requirements for running .NET Framework 3.0.

  CPU required RAM required
Minimum Pentium 400 MHz 96 MB
Recommended Pentium 1 GHz or higher 256 MB or more

Where to Obtain the .NET Framework 3.0 Redistributable Package

You can download Microsoft .NET Framework 3.0 redistributable package from the Microsoft Vista Download Center or from the Microsoft Windows Update Web site.

Note   The Microsoft Windows Update site offers only the officially released version of the .NET Framework 3.0; it does not offer beta versions.

If you need to have users install the Microsoft .NET Framework 3.0 from the Internet, do not post the redistributable package on your own network. Instead, direct users to the Microsoft Vista Download Center or the Microsoft Windows Update Web site.

Redistributing .NET Framework 3.0 Using a Visual Studio 2005 Setup Project

When you deploy applications that are created with Visual Studio 2005 and that require .NET Framework 3.0, the .NET Framework must be installed on the target computer before your application is installed. You can include the .NET Framework 3.0 in a setup executable file that you create using a Visual Studio 2005 setup project. If that is not practical, you can have users install the .NET Framework manually, as described later.

When you configure a Visual Studio 2005 setup project to install Microsoft .NET Framework 3.0 with your application, the .NET Framework 3.0 is packaged with your application. A launch condition in your application's setup checks whether.NET Framework 3.0 is installed, and if necessary, the setup process installs the .NET Framework before installing your application. Microsoft .NET Framework 3.0 in turn checks whether.NET Framework 2.0 is installed. If not, the setup process prompts the user to install the earlier version of the .NET Framework as well.

To include .NET Framework 3.0 with your application's setup process, the optional Visual Studio Extensions for .NET Framework 3.0 must be installed on the computer where you create the setup project.

To determine if Visual Studio Extensions for .NET Framework 3.0 are installed

  1. In the Windows Control Panel, click Add or Remove Programs.
  2. In the Add or Remove Programs dialog box, examine the Currently installed programs list for Microsoft Visual Studio 2005 Extensions for .NET Framework 3.0.

If Visual Studio 2005 Extensions for .NET Framework 3.0 is not listed, you can download and install the extensions package as part of the Development Tools for WinFX, available on the Microsoft Visual Studio Code Name "Orcas" Community Technology Preview – Development Tools for WinFX page on the Microsoft Download Center.

When you are sure you have the Visual Studio Extensions for .NET Framework 3.0 package installed on your computer, you can create a setup project that includes the .NET Framework 3.0.

To include the .NET Framework 3.0 with a setup project

  1. In Visual Studio 2005, create a new setup project following these steps:

    1. In the File menu, click New, and then click Project.
    2. Under Other Project Types, select Setup and Deployment.
    3. Name your project and click OK.
  2. Add your project output, merge modules, file, and assemblies.

  3. In Solution Explorer, right-click the project name and then click Properties.

    The Property Pages dialog box is displayed.

  4. Click Prerequisites.

  5. Select the Create setup program to install prerequisite components check box.

  6. In the list, locate Microsoft .NET Framework 3.0 and then select the version appropriate for the target platforms.

  7. Specify the source location for the prerequisites.

    For the location of the .NET Framework 3.0, you can specify either the Windows Vista Download site or a site of your own. The URL can also specify a CD on which your own application is being distributed.

  8. Click OK.

Having Users Install the .NET Framework Manually

In some situations, it might be impractical for you to automatically install the .NET Framework 3.0 with your application. In that case, you can have users install the .NET Framework themselves. The redistributable is available from several sources as noted earlier in the section Where to Obtain the.NET Framework 3.0 Redistributable Package. However, you should not assume that users of your application know where to get it or how to install it. In your setup process, provide instructions for how users should locate and install the .NET Framework.

Chaining the Redistributable Package in Your Application Setup

If you do not want to create a Visual Studio setup project or have users install the .NET Framework 3.0 manually, you can chain the .NET Framework 3.0 installation process as part of your own application setup. To chain the .NET Framework 3.0 installation process, you can run the redistributable from the command line and use the following silent installation command-line option:

/q /norestart

Redistributing .NET Framework 3.0 for Web Applications

In Web-based applications that rely on .NET Framework 3.0 features, the .NET Framework might need to be downloaded and installed on the user's computer. You can determine whether .NET Framework 3.0 is installed on the user's computer by querying the user-agent string in the browser header. If the correct version of the .NET Framework is not installed, you can direct users to the .NET Framework 3.0 Download Center to obtain the .NET Framework 3.0 package.

Detecting Microsoft .NET Framework 3.0

You can detect if the .NET Framework 3.0 is installed by reading a registry key and by querying the user-agent string in Internet Explorer.

Reading Registry Keys

The .NET Framework 3.0 installer writes registry keys when installation is successful. You can test whether.NET Framework 3.0 is installed by checking the registry keys listed in the following table.

Registry Key Name Value
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup
Name: InstallSuccess

Type: DWORD

Data: 1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform
Name: Version

Type: REG_SZ

Data: .NET CLR 3.0.build number

Reading the User-agent String in Internet Explorer

When .NET Framework 3.0 is installed on a computer, the .NET Framework 3.0 version number appears as part of the user-agent string reported in browser headers. The following example shows a sample page that uses JavaScript to detect and report whether.NET Framework 3.0 is installed.

Note   This sample page requires Internet Explorer.

<HTML>
  <HEAD>
    <TITLE>Test for .NET Framework 3.0</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var NETFX3RuntimeVersion = "3.0.50727";
    
    function window::onload()
    {
      if (HasRuntimeVersion(NETFX3RuntimeVersion))
      {
result.innerText = "This machine has the correct version of the .NET 
Framework 3.0 runtime: " + NETFX3RuntimeVersion + "."  + "\n\nThis 
machine's userAgent string is: " + navigator.userAgent + ".";
      } 
      else
      {
        document.write("The .NET Framework version 3.0 is not installed on this computer.<br/>"
+ "<a href='https://msdn.microsoft.com/windowsvista/default.aspx'>"
+ "Click here to get</a> .NET Framework 3.0 now.");      }
    }
    
    //
    // Retrieve the version from the user agent string and compare with specified version.
    //
    function HasRuntimeVersion(versionToCheck)
    {
      var userAgentString = navigator.userAgent.match(/.NET Framework 3.0 RunTime [0-9.]+/g);

      if (userAgentString != null)
      {
        var i;

        for (i = 0; i < userAgentString.length; ++i)
        {
          if (CompareVersions(GetVersion(versionToCheck), GetVersion(userAgentString[i])) <= 0)
            return true;
        }
      }

      return false;
    }

    //
    // Extract the numeric part of the version string.
    //
    function GetVersion(versionString)
    {
      var numericString = versionString.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/i);
      return numericString.slice(1);
    }

    //
    // Compare the version strings by converting them to numeric format.
    //
    function CompareVersions(version1, version2)
    {
      for (i = 0; i < version1.length; ++i)
      {
        var number1 = new Number(version1[i]);
        var number2 = new Number(version2[i]);

        if (number1 < number2)
          return -1;

        if (number1 > number2)
          return 1;
      }

      return 0;
    }
    
    -->
    </SCRIPT>
  </HEAD>
  
  <BODY>
    <div id="result" />
  </BODY>
</HTML>

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

This machine has the correct version of the .NET Framework 3.0: 3.0.50727.
This machine'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.50727).

Otherwise, the following message appears:

The .NET Framework version 3.0 is not installed on this computer.
Click here to get the .NET Framework 3.0 now.

Command-line Options for the .NET Framework 3.0 Redistributable

The following table lists options that you can include when you run the .NET Framework 3.0 redistributable installation program (Dotnetfx3.exe, Dotnetfx3_x64.exe, or Dotnet3setup.exe) from the command line.

Option Description
/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.