Windows Advisor

Running Multiple Versions of .NET

It can be done on a Windows 2003 server, as long as you remember which version is which.

Whether you're a network administrator or an application developer who has been working with Microsoft technologies for a while, you may have experienced the pain of managing development environments on the Windows platform. In the past, you didn’t have the luxury of running multiple environments on the same computer. The latest version of the libraries would always overwrite previous versions, making it difficult for system administrators to provide developers the flexibility to work with various development environments to efficiently do their job.

Luckily, the .NET architecture no longer restricts you to such limitations. You can install multiple versions of components on a single server and benefit from their peaceful coexistence by running them simultaneously. Microsoft refers to this as side-by-side versioning. Here's an example: If your developers created an application with .NET Framework 1.0, you can run it under version 1.0 or using .NET Framework 1.1.

The default behavior of the client-side applications is a bit different compared to server-side applications. By default, client-side apps use the version of the .NET Framework with which they were built, even if the client is running a later version. The server-side applications built with ASP.NET, on the other hand, use the latest version of the .NET Framework installed on the server by default. (I cover this later, but note that you can specify a specific version that the application should use with the aspnet_regiis.exe command-line tool.)

Any computer that will be running .NET applications requires a common language runtime, which is part of the .NET Framework. Therefore, you need to ensure that you have deployed the redistributable package of .NET Framework on the computers. The latest version, .NET Framework 2.0, supports these OS versions:

  • Windows 98
  • Windows 98 Second Edition
  • Windows ME
  • Windows 2000 Service Pack 3
  • Windows XP Service Pack 2
  • Windows Server 2003

You can download .NET Framework 2.0 (x86) redistributable packages here. You will also need Internet Explorer 5.01 or newer for all versions of .NET Framework. In addition, Windows 98 and Windows ME also requires Windows Installer 2.0 or newer. All other systems require Windows Installer 3.0, although Microsoft recommends using Windows Installer 3.1 or newer. On x86 computers you will need about 280MB of disk space, while x64 systems will require about 610MB. The download page lists some additional server requirements.

Microsoft faces a tough challenge because they are responsible for ensuring that multiple versions of the .NET Framework run smoothly and that they won’t cause any compatibility issues on their OSes. This becomes difficult when developers don’t follow best practices; everyone is ready to blame Microsoft when they run into problems. This is not to say that Microsoft always writes perfect code. Microsoft has to come up with a solution that won’t break legacy applications just because there were some changes made to the libraries. Microsoft came up with a solution to allow ASP.NET applications to be configured to use the version on which they were developed on, and for the client-side applications to use the original libraries with which they were built. This design avoids dependency on the shared libraries and gives administrators a smoother path to upgrading the individual applications.

To make side-by-side versioning work on a single system, each version of .NET Framework is placed in a separate folder. The fully qualified path to the folder includes the version number. For example, the computer running version 2.0.50727 of the .NET Framework is installed at C:\%windir%\Microsoft.Net\Framework\v2.0.50727 (see Figure 1).

.NET Framework versions in their own folders
[Click on image for larger view.]
Figure 1. Multiple versions of .NET Framework placed in their own folders.

The application contains information about the version number so that the common language runtime can determine which version of .NET Framework it should use. Keep in mind that the client-side applications will not use an updated version unless you explicitly tell them to do so. The server-side applications built with ASP.NET will use the latest version of the .NET Framework, unless you use the /noaspupgrade switch with the .NET Framework installer dotnetfx.exe.

Here’s the syntax for preventing ASP.NET applications from being upgraded so they won’t use the latest version of .NET Framework:

dotnetfx.exe /q:a /c:"install /noaspupgrade /l /q"

You can install the .NET Framework silently by using the following syntax, but if you don’t use the /noaspupgrade switch, the ASP.NET applications will be upgraded to use the latest version, as mentioned earlier:

dotnetfx.exe /q:a /c:"install /l /q"

As an administrator, when installing the .NET Framework you can first use the /noaspupgrade switch and then use the command-line aspnet_regiis.exe tool to specify the exact version of the .NET Framework that you want an ASP.NET application to use. This will give you better control over the applications and avoid compatibility issues.

You should use the matching version of the tool that comes with that specific version. For example, you should use the version of aspnet_regiis.exe that comes with .NET Framework 2.0 if you want an application to use .NET Framework 2.0. Similarly, use the version that comes with .NET Framework 1.1 if you want an application to use .NET Framework 1.1.

Windows Server 2003 comes with .NET Framework 1.1 but you can install the latest version 2.0 of .NET Framework, or for backward compatibility you can install version 1.0 of the .NET Framework. Remember to enable each unique version of ASP.NET in the security extensions dialog box of the Internet Information Services (IIS) administration console. Furthermore, each unique version of ASP.NET must run in a separate application pool process under IIS 6.0.

Thanks to side-by-side versioning, managing multiple versions of development environments is much easier now. With Windows Server 2003, IIS 6.0 and the .NET Framework 2.0, you are all set to go.

About the Author

Zubair Alexander, MCSE, MCT, MCSA and Microsoft MVP is the founder of SeattlePro Enterprises, an IT training and consulting business. His experience covers a wide range of spectrum: trainer, consultant, systems administrator, security architect, network engineer, author, technical editor, college instructor and public speaker. Zubair holds more than 25 technical certifications and Bachelor of Science degrees in Aeronautics & Astronautics Engineering, Mathematics and Computer Information Systems. His Web site, www.techgalaxy.net, is dedicated to technical resources for IT professionals. Zubair may be reached at [email protected].

comments powered by Disqus
Most   Popular