Assembly manifest records information about the version of
each dependency it was built against. However, as stated in the above example
where the developer of APP2 may wish to run with a
different version of a dependency at run time. The .NET Framework enables this
flexibility in version binding through version policies.
Assembly Version Numbers
The parts of the version number are major, minor, build and
revision. As a developer you are free to change any portion of this number as
you see fit.
One typical convention is as follows.
Major or minor: Changes to the major
or minor portion of the version number indicate an incompatible change. Under
this convention then, version 220.127.116.11 would be considered incompatible with
Build: The Build number is typically
used to distinguish between daily builds or smaller compatible releases.
Revision: Changes to the revision
number are typically reserved for an incremental build needed to fix a
particular bug. You will sometimes hear this referred to as the "emergency
bug fix" number in that the revision is what is often changed when a fix
to a specific bug is shipped to a customer.
Default Version Policy
The CLR determines which version of the dependency to load
when it comes across a reference to that assembly in code. The default version
policy in .NET is simple, the caller gets the exact version with which the
application was built and tested against.
Custom Version Policy
This is the section we have been talking so long where the
author does not want the CLR to load the default version and redirects the CLR
to the other version defined by the Author.
Version policies are stated in XML files and are simply a
request to load one version of an assembly instead of another.
The following version policy directs the CLR to load version
18.104.22.168 instead of version 22.214.171.124 of an assembly called app1.engine.
This is just a simple XML file. The name of this file is policy.1.0.app1.engine.config. Just place the file exactly
where app1.engine.dll exists, in case of shared assembly it may be GAC.
You can also redirect from a range of versions to another
version. For example, the following policy redirects all versions from 126.96.36.199
through 188.8.131.52 of app1.engine to version 184.108.40.206.
This file is also similar to above example.