I'm learning NHibernate, and I am at the point where I can get a simple app up and running with NHibernate 1.2. Right now, I'm playing with SchemaExport, which I normally invoke from the unit test project in a VS 2008 solution.
I've created a simple GUI wrapper to run SchemaExport. The GUI references its own copy of NHibernate, and it uses the cfg.Configure() overload that lets me specify the config file to use:
Code:
// Create NHibernate SchemaExport object
Configuration cfg = new Configuration();
cfg.Configure(txtCfgFilePath.Text);
SchemaExport schema = new SchemaExport(cfg);
I am using as my target a project with a known working configuration file and mapping files. But when I invoke cfg.Configure() per above, I get this error from NHibernate:
Code:
Could not add assembly MyDemo
The InnerException reads:
Code:
Could not load file or assembly 'WpfNHibDemo' or one of its dependencies. The system cannot find the file specified.":"WpfNHibDemo"
In other words, NHibernate finds the assembly from the config file when I run MyDemo, but it doesn't find it if I use my GUI to load the config file.
While learning NHibernate, I've read that the config file must be in the project output folder of the application calling NHibernate--in this case my GUI. That would explain why NHibernate finds the assembly when I run MyDrmo but not the GUI.
Can anyone shed any light on this problem? How do I get around it? Thanks for your help.
David Veeneman
Foresight Systems