1
votes

We've branched NH 2.0.1 for some minor changes and that worked fine. Our upgrade to 2.1.0 has dll issues with NHibernate.Caches.SysCache being built against a different NH. My main question is how do best deal with this? Can I use some type of assembly mapping, or is there source code I can use to build against?

Here is the error: "Could not load file or assembly 'NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)".

If we comment out the reference in the web.config, this works otherwise.

2

2 Answers

4
votes

Put this in your web.config:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="NHibernate"
                              publicKeyToken="aa95f207798dfdb4"
                              culture="neutral" />
            <bindingRedirect oldVersion="2.1.0.4000"
                             newVersion="X.X.X.X" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

by replacing X.X.X.X by the version you gave to your build.

Remark: If the new version of the assembly is not signed using the same key, the binding redirect won't work. If this is the case you have no choice but to recompile NHibernate.Caches.SysCache against your custom NHibernate build.


UPDATE:

It seems that the private key is included in the repository so you should be good to go :-)

0
votes

There's a new version of NH Caches available that's built against NH 2.1: http://nhibernate.info/blog/2009/07/19/nhibernate-caches-2-1-0ga.html