Udostępnij za pośrednictwem


Assembly Binding Redirection

You can redirect an assembly binding reference to another version of an assembly by using entries in the application or machine configuration files. You can redirect references to .NET Framework assemblies, third-party assemblies, or assemblies of your own application. Each version of the .NET Framework has a machine configuration file, and any redirection information in that file affect all applications running under that version of the .NET Framework.

Redirecting .NET Framework Assembly Binding

The .NET Framework assembly unification model treats all .NET Framework assemblies of a given version, and the runtime of that version, as a single unit. The redirections that occur with this model are the default behavior for the runtime.

There are several ways to instruct the runtime to load a .NET Framework assembly with a different version than that of the loaded runtime:

  • Add settings in the application configuration file.

  • Add settings in the machine configuration file.

  • Create a publisher policy file that is distributed with a component to specify which assemblies a component should use.

A binding redirection in an application configuration file for a unified .NET Framework assembly cancels the unification for that assembly. For example, an application that referenced types in System.XML and was built using runtime version 1.0 would contain static references to the System.XML assembly that shipped with runtime version 1.0. If you wanted to redirect the binding reference to point to the System.XML assembly that shipped with runtime version 1.1, you would put redirect information in the application configuration file. For more information about redirecting .NET Framework assembly references, see Configuring Assembly Binding Redirection.

Note

 The application configuration file redirects only the static reference to an assembly; it does not handle any redirection that may occur because of assembly unification.

An application that performs assembly binding redirection outside the Trusted and Intranet security zones requires a security permission. For more information, see Assembly Binding Redirection Security Permission.

Redirecting Assembly Binding

To redirect an assembly binding reference for an assembly that is not part of the .NET Framework, specify the binding redirection information in the application configuration file using the <assemblyBinding> element.

See Also

Tasks

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

Concepts

Configuring Assembly Binding Redirection

Assembly Binding Redirection Security Permission

Determining Which Version of the Runtime to Load

Other Resources

Side-by-Side Execution