I was lookin all over the internet for this particular problem of mine. I found some suggested solutions but they don't work.
Here is the setup:
I am using ActiveRecord/NHibernate. I created an assembly wrapping ActiveRecord called the BusinessLogic. The idea is that all my projects should use the BusinessLogic instead of referencing ActiveRecord/NHibernate directly.
I installed the following files in the GAC (Global Assembly Cache of .NET):
- Antlr3.Runtime.dll BusinessLogic.dll
- BusinessLogic.dll
- Castle.ActiveRecord.dll
- Castle.Components.Validator.dll
- Castle.Core.dll
- Castle.DynamicProxy2.dll
- Iesi.Collections.dll log4net.dll
- NHibernate.ByteCode.Castle.dll
- NHibernate.dll
The Problem is the following: When I execute my ASP.NET application that reads product information from the database I get the following error message:
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.
If I put a local copy of NHibernate.ByteCode.Castle.dll into the bin folder of the ASP.NET application the error is gone. But a new error shows up. It says that NHibernate cannot find the classes within the BusinessLogic.dll (e.g. Product and so on).
If I put a local copy of BusinessLogic.dll into the bin folder of the ASP.NET application even this error is fixed and the application runs great.
This however is not desired, because I don't want to recompile every application using the BusinessLogic, whenever the BusinessLogic is updated.
I found this article that promised to be helpful: http://markmail.org/message/o22r2x5fng7i6jn5#query:activerecord%20gac+page:1+mid:4rlqoicqyxjh3ypb+state:results
Unfortunately this does not solve the problem.
I put the following into the machine.config file:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="NHibernate.ByteCode.Castle" fullName="NHibernate.ByteCode.Castle,version=2.1.2.4000,publicKeyToken=aa95f207798dfdb4,culture=neutral" />
</assemblyBinding>
</runtime>
The error is still the same. NHibernate cannot find the class NHibernate.ByteCode.Castle.ProxyFactoryFactory
Any help is much appreciated.