Managing Multiple Versions of ASP.NET

The .NET Framework enables you to install multiple versions of the common language runtime (CLR) on the same computer. This enables an ASP.NET application to use the version it needs without affecting other applications. The following sections describe how to install, uninstall, and redistribute multiple versions of ASP.NET on the same computer.

Installing Multiple Versions of ASP.NET

To add a version of ASP.NET to a computer, run the .NET Framework redistributable package setup program (Dotnetfx.exe) for the version you want to install. By default, all existing ASP.NET applications are automatically reconfigured during installation to use the installing version of the runtime if the following conditions are met:

  • The .NET Framework version being installed is later than the version that is currently mapped to the application.

  • The .NET Framework version being installed is compatible with the version mapped to the application. In general, the version number determines compatibility. Minor revision and build number changes are usually compatible, whereas major revision numbers are not.

    NoteNote

    Although ASP.NET applications are automatically updated to use the version of ASP.NET being installed if the preceding conditions are met, custom configuration settings in the current Machine.config file are not transferred to the newly installed Machine.config file. If your application uses custom configuration settings, be sure to either manually update the new Machine.config file or use the ASP.NET IIS Registration tool (Aspnet_regiis.exe) to remap the application back to the previous version of ASP.NET. For more information on remapping an application, see How to: Configure ASP.NET Applications for an ASP.NET Version.

To prevent automatic remapping of all existing applications to the version of the .NET Framework being installed, use the /noaspupgrade command-line option with the Dotnetfx.exe setup program. The following command shows the syntax:

Dotnetfx.exe /c:"install /noaspupgrade"

For more information on the .NET Framework redistributable package, see Redistributing the .NET Framework.

NoteNote

When the .NET Framework is installed through the Add or Remove Programs item in the Windows Control Panel or the Windows Configure Your Server wizard, ASP.NET is enabled in the security lockdown console by default. However, if the .NET Framework is installed through Microsoft Visual Studio, Windows Update, or the .NET Framework redistributable package (Dotnetfx.exe), ASP.NET is disabled by default. For more information on using the security lockdown console in IIS 6.0, see How to: Manage Security Lockdown Console Items.

Uninstalling a Version of ASP.NET

If you have multiple versions of ASP.NET installed on a computer, you can uninstall a specific version. You usually uninstall ASP.NET by uninstalling the .NET Framework through the Add or Remove Programs item in the Windows Control Panel. During the uninstall process, the setup program calls the ASP.NET IIS Registration tool (Aspnet_regiis.exe) with the -u option (uninstall flag).

NoteNote

If you want to uninstall only a version of ASP.NET without uninstalling the associated .NET Framework, you can use Aspnet_regiis.exe directly. Each installation of the .NET Framework contains an associated version of the tool. To uninstall only ASP.NET, use the -u option of the tool version associated with the ASP.NET version you want to uninstall. For more information, see the ASP.NET IIS Registration Tool (Aspnet_regiis.exe).

The -u option of the Aspnet_regiis.exe tool performs the following actions:

  • All ASP.NET applications currently mapped to the ASP.NET version being uninstalled are remapped to the latest compatible version of ASP.NET on the computer. If no compatible version exists, the script map for the application is removed completely.

    Caution noteCaution

    Removing the script maps will cause IIS to serve ASP.NET pages as literal text. This could potentially expose source code to the client.

  • If the ASP.NET version you are uninstalling is currently the latest version, the ASP.NET state service is mapped to the latest compatible version. If no compatible version exists, the ASP.NET state service is uninstalled. (The ASP.NET state service, which is shared across all compatible versions of ASP.NET, is always mapped to the latest installed version of ASP.NET.)

  • Performance objects and the associated performance counters for the version being uninstalled are removed. The generic performance objects and counters that apply to all installed versions of ASP.NET and those for ASP.NET applications are directed to the latest installed version remaining on the computer.

  • If no additional ASP.NET installations remain on the computer, the ASPNET user account and the associated access control lists are removed.

For information on other effects of installing multiple versions of ASP.NET, see ASP.NET Side-by-Side Overview.

Third-Party Redistribution of the .NET Framework

Third-party applications can package and install the .NET Framework as part of their setup under a special redistribution license. This enables an application to install the specific version of the .NET Framework it needs to run. The .NET Framework redistributable package (Dotnetfx.exe) is provided for an application to deploy with the runtime. The default installation script of Dotnetfx.exe might not suit the needs of your application. If so, it is up to you to use the options described below for installing the .NET Framework as part of an application's setup.

For more information on the .NET Framework redistributable package, see Redistributing the .NET Framework. For more information on the end user license agreement (EULA) of the redistributable package, see Where to Obtain the .NET Framework Redistributable Package.

Disabling Automatic Script Map Updates

By default, when the .NET Framework is installed on a computer with an existing installation, all ASP.NET applications are automatically updated to use the new version of the .NET Framework, unless the applications are bound to an incompatible version of the runtime or to a later version of the runtime. Usually, only a system administrator performs this type of installation. When the .NET Framework is installed as part of an application's setup, it should not force other applications on the computer to use that version of the runtime.

As part of the setup script, Dotnetfx.exe normally calls the ASP.NET IIS registration tool (Aspnet_regiis.exe) with the -i option to install ASP.NET. This option attempts to update the script maps of all existing ASP.NET applications. To prevent the installation from automatically updating the script maps of other applications on the computer, use the /noaspnetupgrade option when issuing the Dotnetfx.exe command. This option causes the setup program to use the -ir option of Aspnet_regiis.exe instead, which skips the automatic script map updates, default documentation, and MIME swapping steps. The following command shows the syntax:

Dotnetfx.exe /c:"install /noaspupgrade"

Manually Updating Script Maps

Sometimes it is necessary to manually set up the script maps for an application. If the application needs its own virtual directory that targets the version of the .NET Framework being installed, be sure the application's setup program also explicitly calls Aspnet_regiis.exe with the -s or -sn option to set up the script maps.

The following shows a sample command line that updates the script maps for an application named SampleApp1.

Aspnet_regiis.exe -s W3SVC/1/ROOT/SampleApp1

For more information, see the ASP.NET IIS Registration Tool (Aspnet_regiis.exe).

See Also

Tasks

How to: Manage Security Lockdown Console Items

Reference

ASP.NET IIS Registration Tool (Aspnet_regiis.exe)

Concepts

Where to Obtain the .NET Framework Redistributable Package

Other Resources

Side-by-Side Support in ASP.NET
Redistributing the .NET Framework