Hi!
I'm trying to use NHibernate 2.1.0.Alpha2 from a PowerShell script to do schema exports, test data generation, etc. A great idea, if I only could get it working...
Here's a minimal script that gives me my problem:
[reflection.assembly]::loadfile('C:\TFS\Lernia\Intäktsverktyget\Libs\log4net.dll')
[reflection.assembly]::loadfile('C:\TFS\Lernia\Intäktsverktyget\Libs\NHibernate.dll')
$config = new-object NHibernate.Cfg.Configuration
The exception I get is this:
------------------------------------
System.Management.Automation.MethodInvocationException: Exception calling ".ctor" with "0" argument(s): "The type initializer for 'NHibernat
e.Cfg.Configuration' threw an exception." ---> System.TypeInitializationException: The type initializer for 'NHibernate.Cfg.Configuration' t
hrew an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, Public
KeyToken=1b44e1d426115821' or one of its dependencies. The system cannot find the file specified.
File name: 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821'
at NHibernate.Cfg.Configuration..cctor()
--- End of inner exception stack trace ---
at System.Runtime.CompilerServices.RuntimeHelpers._RunClassConstructor(IntPtr type)
at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle type)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Management.Automation.DotNetAdapter.AuxiliarConstructorInvoke(ConstructorInfo constructor, Object[] arguments, MethodInformatio
n methodInformation, Object[] originalArguments)
--- End of inner exception stack trace ---
at System.Management.Automation.DotNetAdapter.AuxiliarConstructorInvoke(ConstructorInfo constructor, Object[] arguments, MethodInformatio
n methodInformation, Object[] originalArguments)
at System.Management.Automation.DotNetAdapter.ConstructorInvokeDotNet(ConstructorInfo[] constructors, Object[] arguments)
at Microsoft.PowerShell.Commands.NewObjectCommand.CallConstructor(ConstructorInfo[] constructors, Object[] args)
------------------------------------
So it seems that the first time NHibernate wants to use log4net I get this exception that something cannot be found. I have tried explicitly loading all DLLs that log4net references, but that doesn't help.
Any ideas of how to fix this, or debug the problem, are most appreciated!
Cheers,
Emil
|