Using Visual Studio 2005 to Redistribute the .NET Framework 2.0

 

Microsoft Corporation

March 2006

Applies to:
   .NET Framework 2.0

Summary: This article describes how to use Microsoft Visual Studio 2005 to deploy Microsoft .NET Framework 2.0 applications with Dotnetfx.exe, the .NET Framework redistributable package. (5 printed pages)

Note   If you choose to use the Dotnetfx.exe or redistribute it with an application created by you, you must have a validly licensed copy of the Microsoft .NET Framework SDK version 2.0 (or Visual Studio 2005) and any use or distribution of Dotnetfx.exe is subject to the terms of the end user license agreement you received with the Microsoft .NET Framework SDK version 2.0 (or Visual Studio 2005). If you do not have a validly licensed copy of the Microsoft .NET Framework SDK version 2.0 (or Visual Studio 2005), you are not authorized to use or distribute Dotnetfx.exe.

Contents

Introduction
Where to Obtain the .NET Framework Redistributable Package
Visual Studio 2005 Deployment Scenarios

Introduction

The version 2.0 release of the Microsoft .NET Framework provides one redistributable installer that contains the common language runtime and .NET Framework components that are necessary to run .NET Framework applications. The .NET Framework redistributable is available as a stand-alone executable file, Dotnetfx.exe. The .NET Framework requires a license agreement that gives you specific rights to redistribute Dotnetfx.exe. If you have previously installed the Microsoft .NET Framework SDK version 2.0, Microsoft Visual Studio 2005, or downloaded Dotnetfx.exe from the Web, you have accepted the license agreement for Dotnetfx.exe. For the terms of the license agreement, see the .NET Framework Redistributable EULA.

This article covers deployment scenarios for Visual Studio 2005 users.

There are minimum configuration requirements that must be met in order to install Dotnetfx.exe. For more information about software and hardware requirements and recommendations, see Minimum Configuration Requirements.

Where to Obtain the .NET Framework Redistributable Package

You can download Dotnetfx.exe from MSDN Online or from the Microsoft Windows Update site.

Alternately, you can get the redistributable package on a Microsoft .NET Framework DVD. The redistributable packages for .NET Framework 2.0 are available on the DVD in the directory

<LANGUAGE_CODE>\Runtime\dotnetfx.exe

where <LANGUAGE_CODE> represents locale language, or from Disc 1 of the Microsoft Visual Studio 2005 in the \wcu\dotNetFramework directory.

If you need to have users install the .NET Framework from the Internet, do not post the .NET Framework Redistributable Package. Instead, direct users to the Microsoft Windows Update site.

Visual Studio 2005 Deployment Scenarios

This section describes some possible scenarios for distributing the .NET Framework 2.0 redistributable, Dotnetfx.exe, using Visual Studio 2005. Because Dotnetfx.exe is a significant runtime component, you must have administrator privileges in order to install it on a computer. There are three methods for deploying a .NET Framework 2.0 application:

Deployment with Unattended Installation

The .NET Framework can be deployed using Windows Server Update Services (network administrators only). In this case the deployment could be performed silently using Unattended Install with the following command:

Dotnetfx.exe /q:a /c:”install /q”

Instruct the User to Manually Install the .NET Framework 2.0

The .NET Framework redistributable package, Dotnetfx.exe, is a stand-alone executable file that can be run to install the .NET Framework. The redistributable is available from several sources (for details, see Where to Obtain the .NET Framework Redistributable Package); however, you should not assume that users of your application know where to get it or how to install it. For this reason, you should modify your deployment project to provide instructions to the user.

Installers created using Visual Studio .NET deployment tools include a default launch condition (MsiNetAssemblySupport) that checks for the .NET Framework on the target computer. If it is not found, installation is halted and a dialog box displayed informing that the setup requires the .NET Framework.

The message in the unsatisfied launch condition dialog box can be customized to prompt user to install NET Framework from a CD, or provided link determined by the InstallUrl property; in many cases you will want to modify the InstallUrl property to point to your own location for the redistributable file.

To customize the launch condition message

  1. In Solution Explorer, select the deployment project.
  2. On the View menu, click Editor, and then click Launch Conditions.
  3. In the Launch Conditions Editor, select the MsiNetAssemblySupport node.
  4. In the Properties window, select Message and replace [VSDNETMSG] with your custom message text.

Note The default message is automatically translated for localized versions of the installer. If you customize the text, you will need to translate it yourself for any localized versions.

Installing the .NET Framework 2.0 Using the Visual Studio 2005 Bootstrapper Setup

You can add Microsoft .NET Framework 2.0 or any other prerequisite to a Visual Studio 2005 project as a prerequisite for your application. The first step for the user then would be to launch the created Bootstrapper executable, called setup.exe.

Setup.exe will detect whether any of the prerequisites you specify are already installed. In case any are missing, the Bootstrapper lists those components and displays their license agreement. Otherwise, Bootstrapper simply launches the application installer.

Once the user accepts the agreement, the download and installation process begins. Otherwise, the installation is canceled and the Bootstrapper displays a progress bar to show how much of the process was completed.

When all of the prerequisites have been installed, the Bootstrapper kicks off the installation process of the application itself. Having launched the application installer, it gets out of the way and leaves it to the application installer to display any UI and perform the necessary installation operations for the application. The Bootstrapper does not dictate which installer technology the app must use; it can use Windows Installer, ClickOnce, or any other technology. In the case of installing a ClickOnce application, the user would see the standard ClickOnce installation dialog box, enabling him to install and run his application.

To create a Bootstrapper setup for a project and add Microsoft .NET Framework 2.0 as a prerequisite:

  1. On the File menu, click New and then click Project.

  2. In the New Project dialog box, expand Other project types and then click Setup and Deployment.

  3. In the templates list, double-click Setup Project.

  4. Add project output, merge modules, files, and assemblies to the project as needed.

  5. In Solution Explorer, right-click the setup project and then click Properties. The Property pages box will appear.

  6. Click Prerequisites and then select Create setup program to install the prerequisite components.

  7. In Choose which prerequisite to install (for example .NET Framework 2.0, and Windows Installer 3.1).

  8. In Specify the install location for prerequisites, choose the appropriate option for your application.

    Note: You can have users download the .NET Framework from the Microsoft Download Center Web site or a custom site specified by you. The URL can also point to an offline version of the redistributable file on CD-ROM.

  9. Click OK to close Prerequisites window.

  10. Click OK to close Property Pages window.

  11. Press F6, or select Build Solution to have Bootstrapper setup.exe and MSI package generated for you.

Alternatively to create the setup package for an existing project:

  1. In Solution Explorer, right-click the setup project and then click Properties. The Project Designer window will appear.
  2. Click the Publish tab.
  3. Click Prerequisites and then select Create setup program to install the prerequisite components.
  4. In Choose which prerequisite to install, select .NET Framework 2.0.
  5. In Specify the install location for prerequisites, choose the appropriate option for your application.
  6. Click OK to close Prerequisites window.
  7. Click Publish Now button to have Bootstrapper setup.exe and MSI generated for you.

Depending on the selected install location for prerequisites redistributables, such a .NET Framework 2.0, will be packaged with the Setup.exe for the project when it is built. Visual Studio 2005 will include several frequently used components in the Prerequisite box, including the .NET Framework 2.0, J# Runtime 2.0, SQL Server 2005 Express Edition, Microsoft Data Access Components (MDAC) 2.8, and Windows Installer 2.0 and 3.1. The Bootstrapper is also extensible, so you can add additional Microsoft (Language Packs) and third-party components as needed. It's a generic installation engine with a flexible configuration system—you can plug into the Bootstrapper just about any installer packaged as a Microsoft Installer (MSI) or executable program. To extend it to a particular component, the developer must author a pair of XML manifests that contain the installation metadata for the component.