Bagikan melalui


Working With Multiple Versions of the .NET Framework

By default, managed applications created with Visual Studio .NET 2003 or later require version 1.1 of the common language runtime in order to run. There may be some cases where you want your application to target an earlier version of the runtime. For example, if all of your customers have already installed runtime version 1.0 and deploying version 1.1 is not feasible, you may want to target version 1.0.

Note

Although it is possible to target version 1.0 of the common language runtime from Visual Studio .NET 2003, it is highly recommended that you use Visual Studio .NET 2002 for that instead. You can install and run both versions side-by-side on the same computer. For more information, see Installation and Setup.

Warning

Targeting a previous version of the runtime could cause the application to fail if it references .NET Framework classes or members that did not exist in the previous version. You should thoroughly test your application against all specified versions to make sure that it runs properly. For more information on the differences between version 1.0 and 1.1, see What's New in the .NET Framework Version 1.1.

Visual Studio .NET 2003 projects use the Supported Runtimes property to specify the required versions of the common language runtime. This property is only available for Windows Application, Windows Service, Console Application, and ASP.NET Web Application projects.

The Supported Runtimes property can be set in the Project Property Pages dialog box.

Note

When you specify version 1.0, the app.config file will be modified with a section specifying that it can run on version 1.0 of the runtime. The application will actually be built using the version 1.1 compiler, and will be a version 1.1 application in all other respects.

In the event that you specify support for more than one runtime version, when the application runs on a computer with more than one runtime version installed, the first available version listed in the .config file will be loaded.

Windows Application, Windows Service, or Console Application Projects

For these project types, selecting a runtime causes the project system to update the app.config file in your project, or create an app.config file if one does not already exist. At run time, the name of the app.config file must be filename.ext.config and the file must be in the same directory as the executable. The project system will create the filename.ext.config file from the app.config file and place it in the bin\target directory.

ASP.NET Web Application Projects

For ASP.NET Web Application projects, modifying this property causes the project system to update the web.config file in your project by adding assembly binding (<bindingRedirect> and <assemblyIdentity>) tags in a <dependentAssembly> section. Web pages in Visual Studio-built ASP.NET web applications are precompiled to a .dll with a dependency on the runtime associated with the compiler.

The web.config file remains in the project directory and is not renamed.

For more information, see ASP.NET Side-by-Side Overview

See Also

Concepts

ASP.NET Side-by-Side Overview

Other Resources

Side-by-Side Execution