R – ActiveWriter and NHibernate: Can’t generate

nhibernate

I'm trying to generate NHibernate mappings with ActiveRecord. I can create classes from a diagram by targeting ActiveRecord, but whenever I target NHibernate, I get the following error:

Error 1 Running transformation: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.IO.FileNotFoundException: Could not load file or assembly 'NHibernate, Version=1.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The system cannot find the file specified.
File name: 'NHibernate, Version=1.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'
at Castle.ActiveRecord.ActiveRecordStarter.SetUpConfiguration(IConfigurationSource source, Type type, ISessionFactoryHolder holder)
at Castle.ActiveRecord.ActiveRecordStarter.Initialize(IConfigurationSource source, Type[] types)
at Castle.ActiveRecord.ActiveRecordStarter.Initialize(Assembly assembly, IConfigurationSource source)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

I am referencing the NHibernate DLL, but it is version 2.0.1.4000 . I added the following into the web.config:
<dependentAssembly>
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral"/>
<bindingRedirect oldVersion="1.0.0.0-1.2.0.4000" newVersion="2.0.1.4000"/>
</dependentAssembly>

but it is still trying to grab the old NHibernate DLL. Is there something else that must be done to use the new NHibernate?

Best Answer

I ended up scrapping the idea of using newer NHibernate versions and unpacked all the external dlls from the Castle project into the bin directory of the Castle project. After setting that, I was able to generate NHibernate mappings.

Related Topic