Friday, December 16, 2011

Redirecting Assembly Versions

When you build a .NET Framework application against a specific version of a strong-named assembly, the application uses that version of the assembly at run time. However, sometimes you might want the application to run against a newer version of an assembly. An application configuration file, machine configuration file, or a publisher policy file can redirect one version of an assembly to another.
The simplest, is to modify the assembly bindings to redirect one version of an assembly to another.
In the example below the bindingRedirect allows requests for version of this particular assembly to be serviced by version So long as we’re sure the deserializing functionality is compatible, this solves the problem without having to change any code.

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
 <assemblyIdentity name="Configuration" publicKeyToken="........." culture=""/>
 <bindingRedirect oldVersion="" newVersion="" />
 <codeBase href="C:\bin\Configuration.dll" version="" />

Submit this story to DotNetKicks