Udostępnij za pośrednictwem


Locating Runtime Version Information

Information on which runtime version an application or component was compiled with and which versions of the runtime the application requires to run are stored in two locations. When an application or component is compiled, information on the runtime version used to compile it is stored in the managed executable. Information on the runtime versions the application or component requires is stored in the application configuration file.

Runtime Version Information in the Managed Executable

The portable executable (PE) file header of each managed application and component contains information about the runtime version it was built with. The common language runtime uses this information to determine the most likely version of the runtime the application needs to run.

Runtime Version Information in the Application Configuration File

In addition to the information in the PE file header, an application can be deployed with an application configuration file that provides runtime version information. The application configuration file is an XML-based file, which is created by the application developer, that ships with an application. This file can specify which versions of the runtime and which versions of a component the application supports. You can also use this file in testing to test an application's compatibility with different versions of the runtime. For details on how the runtime uses the application configuration file to determine which runtime version to load, see Targeting a .NET Framework Version.

Unmanaged code, including COM and COM+ applications, can have application configuration files that the runtime uses for interacting with managed code. The application configuration file affects any managed code that you activate through COM. The file can specify which runtime versions it supports, as well as assembly redirects. By default, COM interop applications calling to managed code use the latest version of the runtime installed on the computer.

See Also

Tasks

How to: Use an Application Configuration File to Target a .NET Framework Version

Concepts

Configuring Assembly Binding Redirection

Other Resources

Side-by-Side Execution