Downgrade (use a library with a lower version) with binding redirection

I am using an older version of NHibernate (v3.0.0.1001) and I am stuck on it because the new LINQ provider splits some of my queries (I will try to fix something later). I want to update a library that uses NHibernate v3.1.0.4000.

I tried to add a binding redirect in App.config:

<?xml version="1.0"?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-3.1.0.4000" newVersion="3.0.0.1001"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration> 

But when I compile, I get:

error CS1705: Assembly 'My3rdPartyDll, Version=0.5.0.170, Culture=neutral, PublicKeyToken=null' uses 'NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' which has a higher version than referenced assembly 'NHibernate, Version=3.0.0.1001, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'

Can I use snapping redirection to indicate downgrade?

+4
source share
1 answer

You can use the probing element to specify a specific dll search folder, and then you can just go through the dll to that folder.

 <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatePath="Assemblies"/> </assemblyBinding> </runtime> 

You can also specify the specific assembly to use, which I think you are looking for.

  <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="WorkflowLibrary1" publicKeyToken="8afb6d596a769080" /> <codeBase version="1.0.0.0" href="Version_1_0_0_0/WorkflowLibrary1.dll"/> </dependentAssembly> </assemblyBinding> </runtime> 

This link contains more information about this.

+3
source

All Articles