开发者

Need help with NHibernate assembly version issue. Error with loading the correct assembly version

NOTE I closed my other ticket that was to localized.

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 r开发者_C百科eference. (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?


I can't comment on the specific problem with NuGet but you should be able to get around the error by the adding an assembly binding redirect to your app.config or web.config.

You might want to check the public key tokey there is correct.

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Nhibernate" publicKeyToken="aa95f207798dfdb4"/>
        <bindingRedirect oldVersion="3.0.0.2001" newVersion="3.0.0.4000"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

That should redirect all requests for the for 2001 to 4000


I don't know how many web projects you have, and which is your start project setup, is basic, but I had the same problem with my test method and I discovered that my app.config of my test project didn't have the binding redirect.

In my case the Add-BindingRedirect command generate something like this

 <dependentAssembly>
        <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.4000" newVersion="3.0.0.4000" />
      </dependentAssembly>

This solved my problem, I hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜