Configuring a COM Application for Side-by-Side Execution
An application configuration file enables a COM application to bind to a specific managed component and specify which version of the runtime runs the component. COM application developers can create a .NET Framework application configuration file and deploy it with their applications.
Default Loading Behavior
If an unmanaged application does not have an application configuration file, the version of the runtime that is used to load the component is determined as follows:
If the component was created with the .NET Framework version 4 or later, it is loaded with the runtime that was used to create it.
If the component was created with an earlier version of the .NET Framework, it is loaded with the latest version of the runtime that is installed on the computer and that is less than version 4. For example, if a component was created with the .NET Framework version 1.1, and three versions of the .NET Framework (the .NET Framework 1.1, the .NET Framework 3.5 SP1, and the .NET Framework 4) are installed on the computer, the component is loaded with the .NET Framework 3.5 SP1. This was the default behavior before the .NET Framework 4.
This loading behavior affects components that are loaded side-by-side in the same process. The runtime for the .NET Framework 4 can run in-process with a runtime from an earlier version of the .NET Framework. See In-Process Side-by-Side Execution.
Specifying the Runtime Version
If the default loading behavior does not satisfy the requirements of your COM application, you can use the <supportedRuntime> element in an application configuration file to specify the runtime version that your application requires. For example, you can specify runtime version 1.1.4322, which loads the .NET Framework version 1.1. For instructions, see Targeting a .NET Framework Version.
COM applications hosted by an extensible host, such as Microsoft Internet Explorer or Microsoft Office cannot control which version of the runtime is loaded.
If you have components that were created with both the .NET Framework 4 and an earlier version of the .NET Framework, you must list both versions as supported runtimes, because the default loading behavior does not use the .NET Framework 4 to load the earlier component. To force the earlier component to load with the .NET Framework 4, set the useLegacyV2RuntimeActivationPolicy attribute to true in the <startup> element of your configuration file. This reverts to the default loading behavior before the .NET Framework 4, which is to use the latest supported .NET Framework version.
Specifying an Assembly Version
Without an application configuration file, the runtime loads the latest version of the assembly registered in the Windows registry that contains the type to be activated from COM. You can use the <bindingRedirect> element in an application configuration file to direct your application to bind to an earlier assembly version. For instructions, see Redirecting Assembly Versions.
You can redirect more than one assembly version by including multiple <bindingRedirect> elements within a <dependentAssembly> element.