We have two version of the same assembly in GAC? I want my client to make choice of which assembly to choose?
views:
373answers:
3You can program your application to edit app.config file. You should write something similar to this:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="yourassembly" publicKeyToken="96D09A1EB7F44A99" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.2.8.0" newVersion="2.2.8.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
in your app.config. This will allow to specify assembly version your application needs.
You can use System.Activator class and its static CreateInstance method which has number of overloads. You can specify the full assembly name in a format like System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Try the following in your config file:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="clsLibVsn"
publicKeyToken="b035c4774706cc72"
culture="neutral"/>
<bindingRedirect oldVersion= "1.1.1830.10493"
newVersion= "1.0.1830.10461"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
You need to specify “bindingRedirect” in your config file. For ins in the above case “clsLibVsn” has two versions “1.1.1830.10493” and “1.0.1830.1 from which “1.1.1830.10493” is the recent version. But using the bindingRedirect we can s saying “1.0.1830.10461” is the new version. So the client will not use “1.1.1830.10493”.