Side-by-Side execution is a great facility but if shared assembly (assembly in GAC) developers maintain backward compatability configuring the publisher's policy for shared assemblies make .NET Rock.
There are basically 2 ways to configure your shared assembly -
The SnapIn is really fast, neat and less-error prone way to do but in most practical situations not usable.
To configure via SnapIn, right click on Configured assemblies node in the left pane, select 'Add' menu option. After this configuration is intuitive.
Using policy assembly is the way mostly every shared assembly developer will use as it is just to be installed in GAC and then its upto the CLR to do the magic of assembly binding.
Steps for creation of the assembly are :
Here is the snippet for sample policy file which says that CLR should bind the host application reference to version 1.1.0.0 instead of 1.0.0.0
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="LibInGac" publicKeyToken="5bb6adc75ec4790c" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Now run the al with the following command line :
al /link:LibInGac.dll.config /out:policy.1.0.LibInGac.dll /keyfile:mysnk.snk /version:1.1.0.0
Important thing here is to get the above command line correct.
-
/link:name_of_file.config
-
/out:policy.MajorVersionOfOldAssembly.MinorVersionOfOldAssembly.OriginalAssemblyName.dll
-
/keyfile:key_pair_file
-
/version:Version_for_policy_file
/version is an important option as you may want to override your previous policy assembly. CLR will look into the policy assembly with greater version number.
/Key_pair_file should be the same key-pair with which assembly being accessed (here LibInGac) was signed.
/out:policy.MajorVersion.MinorVersion.AssemblyName.dll
I was looking at GDN quick start sample and found out after hit-n-trial that options provided to 'al' are wrong. Also MSDN does not specify major version and minor version are that of original assembly or new assembly.