Sometimes you may want calls to an older version of a component in the GAC to be diverted to a newer version of the component.
In order to do this, you need to create a policy redirect file and drop this into the GAC. The following must be done (the example is for an assembly named My.Assembly:
1. Create an XML file containing redirect information
<?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="My.Assembly" publicKeyToken="17374ea5a1072ad8" /> <bindingRedirect oldVersion="188.8.131.52" newVersion="184.108.40.206" /> <bindingRedirect oldVersion="220.127.116.11" newVersion="18.104.22.168" /> <bindingRedirect oldVersion="22.214.171.124" newVersion="126.96.36.199" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration>
In this example, the XML file is called “policy.1.0.My.Assembly.xml”.
2. Create the policy redirect DLL
Use the Assembly Linker tool to create the policy redirect dll:
al /link:policy.1.0.My.Assembly.xml /out:policy.1.0.My.Assembly.dll /keyfile:"C:\DevKeyFiles\sgKey.snk" /version:188.8.131.52
3. Add redirect to the GAC
Step 2 should have created a dll file which can then be dragged and dropped in the GAC (usually located at C:\WinNT\assembly).