开发者

NHibernate "Could not find a part of the path" problem

开发者 https://www.devze.com 2023-01-09 00:07 出处:网络
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.

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.开发者_如何学GoConfigure();

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号