Introduction:
Here I will explain if we have two version of same assembly in GAC how we make a choice.
Description:
In interviews it’s common Question for everyone. Let’s say you have made an application and its using a DLL which is present in GAC. Now for some reason you make second version of the same DLL and put it in GAC. Now which DLL does the application refer? Ok by default it always uses the version by which you have compiled you application in IDE. But you want that it should actually use the older version.
In that situation you need to specify “bindingRedirect” in your config file. For instance in the below case “ClassLibraryVersion” has two versions “1.1.1830.10493” and “1.0.1830.10461” from which “1.1.1830.10493” is the recent version. But using the bindingRedirect we can specify saying “1.0.1830.10461” is the new version. So the client will not use “1.1.1830.10493”.
<configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="ClassLibraryVersion" publicKeyToken="b035c4774706cc72" culture="neutral"/> <bindingRedirect oldVersion= "1.1.1830.10493" newVersion= "1.0.1830.10461"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration> |
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
0 comments :
Note: Only a member of this blog may post a comment.