Binding Policy

When the common language runtime is asked to bind to a specific version of a strong-named assembly, the version of the assembly reference can be altered at several policy-resolution stages before the common language runtime finally decides which version to bind to. This policy-resolution process allows an assembly reference, which is specified at compile time, to be modified after the application has been deployed, without recompiling the assemblies involved. Policy resolution happens in the following three stages:

  1. Application-policy resolution.
  2. Publisher-policy resolution.
  3. Administrator-policy resolution.

In each stage, an XML configuration file that describes the policy is read. The <privatePath> tag in the application configuration file (which is described in (3) Path for Private Components illustrates the simplest form of application-policy resolution. In addition, the <BindingRedirect> tag can be used to redirect the reference to a different version of a strong-named assembly. (The version numbers of private assemblies are not checked.)

Publisher-policy resolution allows shared-component vendors to make compatibility statements among different revisions of their software. These per-assembly configuration files are distributed as strongly named assemblies and are installed into the global assembly cache (GAC) as part of a service pack–style update. Binding redirects specified by the publisher-policy file are then applied to the reference, which is then subject to administrator–policy resolution. Because publisher-policy assemblies affect all applications on the system, it is important that these assemblies are installed separately from the application.

Administrator-policy resolution is the final — and the strongest — stage in the binding policy-resolution process. The administrator-policy file is located in the <WindowsDirectory>\Microsoft.NET\Framework\v1.0.FinalBuildNumber\CONFIG directory and is called Machine.config. This file has the same XML-based schema as the policy files used in the two previous stages of policy resolution. Administrator policy affects all assembly bindings that occur on the system and can never be bypassed.

See Also

Deploying Versioned Components | Packaging and Deployment Summary | Appendix A: Additional Packaging and Deployment Information | Appendix B: Packaging and Deployment Tools