How to get NHibernate.Validator working with NHibernate 4?

654 Views Asked by At

I have upgraded my software from NHibernate v2.1.2.4000 (which was compatible with NHibernate.Validator v1.2.3001) to NHibernate v4.0.2.4000.

Now I am trying to use NHibernate.Validator v1.3.2.4000, which according to the website https://www.nuget.org/packages/NHibernate.Validator/ should work with NHibernate versions >= 3.3.1.4000.

But I can't get it to work. Because of the following error: Could not load file or assembly 'NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies.

Is there a way to get my software working with NHibernate v4.0.2.4000 combined with this or any version of NHibernate.Validator?

1

There are 1 best solutions below

0
Rene On

Redirect NHibernate v3.3.1.4000 to v4.0.0.4000 with the following configuration in app.config.

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">          
        <dependentAssembly>
            <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
            <bindingRedirect oldVersion="3.3.1.4000" newVersion="4.0.0.4000" />
            <publisherPolicy apply="no" />
        </dependentAssembly>
    </assemblyBinding>

Add and reference the following assemblies:

  • NHibernate.ByteCode.Castle 3.3.3.4000
  • Castle.Core 3.2.0.2256