tags:

views:

23

answers:

1

I'm trying to use NHibernate with my project, I've generated NHibernate class and xml file using NGen. After that, I try to test my application but when I run to second line of this code.

var configuration = new Configuration();
configuration.Configure();

It show error message like below.

Could not find a part of the path 'D:\App\bin\Debug\hbm\MyFile.hbm.xml'.

Obviously this file doesn't exist, because it's located in D:\App\bin\Debug*\Data*\hbm\MyFile.hbm.xml

I want to know how to solving this problem?

+2  A: 

The best solution is to set your file (MyFile.hbm.xml) as "Embedded Resource" in your Visual Studio project (Properties on File -> Build Action : Embedded Resource), and then, recompile, it'll be fine.

Olivier DUVAL
I already done that but these files are located in another project, so after compile they ware located in "sub-folder\hbm" not \hbm
In The Pink