Error loading one of the NHibernate dependent dll's

左心房为你撑大大i 提交于 2019-12-23 12:29:18

问题


I am building an application using NHibernate. Because I could not add the DLL's of my current version of NHibernate (I cannot add reference when framework 4.0 is target).

I tried to get the latest and greatest of the w.w.w., this is what I have now:

  • NHibernate.dll (3.2.0.4000)
  • NHibernate.ByteCode.Castle (3.0.0.4000)
  • FluentNHibernate.dll (1.2.0.694)
  • Castle.Core (2.5.2.0)
  • Castle.Services.Logging.NLogIntegration (2.5.2.0)
  • Antlr.Runtim (3.1.3.42154)
  • Iesi.Collections (3.2.0.400)

These I can reference and build my solution with. I know there are some issues with the copying/loading of the dll.s so I made them deployment items. But run-time I (still) get the following:

NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly was not deployed. - The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed.

Solution:

Confirm that your deployment folder contains one of the following assemblies:

NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll ---> System.TypeLoadException: Method 'IsProxy' in type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory' from assembly 'NHibernate.ByteCode.Castle, Version=3.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' does not have an implementation.

Thoughts anyone?

In response to Vijay Gill’s answer I have decided to take a different tack.

NUGet packages, a one-stop shop, and easy updates!

There is a FluentNHibernate package out there. I have installed it but I guess there is something amiss here too:

Test method CoreDatabaseTests.CreateCoreDatabase threw exception:

System.IO.FileLoadException: Could not load file or assembly 'NHibernate, Version=3.2.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) ---> System.IO.FileLoadException: Could not load file or assembly 'NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.


回答1:


Getting components from various locations in such cases is nto a good idea, you compile everything from scratch. Well that's my experience so far. Fluent NH has not been updated to NH 3.2GA.

I would suggest you to download fluent NH and stick with the version that comes with it OR if you want to be on the bleeding edge, download the sources of fluent NH and compile with references set to latest NH (3.2GA).




回答2:


With NHibernate 3.2 you don't need NHibernate.ByteCode.Castle anymore, which considerably simplifies your dependency tree.



来源:https://stackoverflow.com/questions/6911792/error-loading-one-of-the-nhibernate-dependent-dlls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!