I'm creating a new MVC 4 website, and I'd like to use the Unity.MVC3 library to integrate with the DependencyResolver stuff built into MVC.
I also want to reference some data-access DLLs from an older, much larger project.
My problem is that Unity.MVC3 and the older DLLs are compiled against different versions of Unity, 1.2.0.0 and 2.1.505.0, respectively. I tried creating a binding redirect in my web.config file like so:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersions="1.2.0.0-2.1.505.0" newVersion="2.1.505.0" />
</dependentAssembly>
However, I still get the following error:
Could not load file or assembly 'Microsoft.Practices.Unity, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I turned on assembly binding logging, and the last two lines state:
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Why isn't my binding redirect being respected? Is there a way to override its checking for major version conflicts?