Udostępnij za pośrednictwem


<supportedRuntime> Element

Specifies which versions of the common language runtime the application supports. This element should be used by all applications built with version 1.1 or later of the .NET Framework.

<configuration>

   <startup>

      <supportedRuntime>

<supportedRuntime version="runtime version" sku="sku id"/>

Attributes

Attribute

Description

version

Optional attribute.

A string value that specifies the version of the common language runtime (CLR) that this application supports. The first three versions of the CLR are specified by "v1.0.3705", "v1.1.4322", and "v2.0.50727". Beginning with the .NET Framework version 4, only the major and minor version numbers are required (that is, "v4.0" instead of "v4.0.30319"). The shorter string is recommended.

Note

The .NET Framework version 3.0 and 3.5 use version 2.0.50727 of the CLR.

sku

Optional attribute.

A string value that specifies the SKU that runs the application. For more information, see .NET Framework Client Profile.

Remarks

If the <supportedRuntime> element is not present in the application configuration file, the version of the runtime used to build the application is used.

The <supportedRuntime> element should be used by all applications built using version 1.1 or later of the runtime. Applications built to support only version 1.0 of the runtime must use the <requiredRuntime> element.

Note

If you use the CorBindToRuntimeByCfg function to specify the configuration file, you must use the <requiredRuntime> element for all versions of the runtime. The <supportedRuntime> element is ignored when you use CorBindToRuntimeByCfg.

When multiple versions of the runtime are supported, the first element should specify the most preferred version of the runtime, and the last element should specify the least preferred version.

Note

If your application uses legacy activation paths, such as the CorBindToRuntimeEx function, and you want those paths to activate version 4 of the CLR instead of an earlier version, or if your application is built with the .NET Framework 4 but has a dependency on a mixed-mode assembly built with an earlier version of the .NET Framework, it is not sufficient to specify the .NET Framework 4 in the list of supported runtimes. In addition, in the <startup> element in your configuration file, you must set the useLegacyV2RuntimeActivationPolicy attribute to true. However, setting this attribute to true means that all components built with earlier versions of the .NET Framework are run using the .NET Framework 4 instead of the runtimes they were built with.

Example

The following example shows how to specify the supported runtime versions in a configuration file.

<configuration>
   <startup>
      <supportedRuntime version="v1.1.4322"/>
      <supportedRuntime version="v1.0.3705"/>
   </startup>
</configuration>

Configuration File

This element can be used in the application configuration file.

See Also

Reference

Startup Settings Schema

Concepts

Specifying Which Runtime Version to Use

In-Process Side-by-Side Execution

Other Resources

Configuration File Schema for the .NET Framework