So I am having a problem like I see other posters have had after using NuGet to install FluentNhibernate:
ERROR
Could not load file or assembly 'NHibernate, Version=3.0.0.2001, 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)
I saw that on stackOverflow answers and other blogs the answer was:
Add-BindingRedirect
However, this has not resolved my issue and all the results of running that command is:
PM> Add-BindingRedirect
Name OldVersion NewVersion
---- ---------- ----------
NHibernate 0.0.0.0-3.0.0.4000 3.0.0.4000
When I am installing Fluent Nhibernate from NuGet, it says its dependencies are Nhibernate 3.0.0.2001 but it installs Nhibernate 3.0.0.4000
What am I doing wrong?
UPDATE
I see that it adds the following section in the node:
<dependentAssembly>
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.4000" newVersion="3.0.0.4000" />
</dependentAssembly>
However, I still get the same error. Which just doesn't look right. If Fluent is wanting 3.0.0.2001 and NHibernate 3.0.0.4000 was installed, this binding redirect, doesn't appear to me to be correct.
To be as specific as possible. I just used NuGet to install Fluent Nhibernate in both my Web Project and a C# library project for tests. Then ran a test using NUnit which continues to give me this error.
Add-BindingRedirect is the correct command to run, and the output you get is what's expected. After you run it, you should see some binding redirect entries in your web.config (or app.config). Can you confirm that?
That will then allow the assembly to be loaded even though FluentNH asks for an older build of NHibernate.
If that doesn't work for you, please include more details in your question about what you are doing. e.g. what is the complete sequence of steps that leads to seeing the error you report (starting with project creation).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With