Fluent NHibernate无法使用SQLCE创建会话工厂

Fluent NHibernate无法使用SQLCE创建会话工厂,nhibernate,fluent-nhibernate,Nhibernate,Fluent Nhibernate,我正在用Fluent NHibernate(这方面的任何NHibernate风格)尝试我的第一个项目。我无法通过创建会话工厂对象,因为我遇到了以下异常: InnerException: NHibernate.HibernateException Message=The IDbCommand and IDbConnection implementation in the assembly System.Data.SqlServerCe could not

我正在用Fluent NHibernate(这方面的任何NHibernate风格)尝试我的第一个项目。我无法通过创建会话工厂对象,因为我遇到了以下异常:

InnerException: NHibernate.HibernateException
                      Message=The IDbCommand and IDbConnection implementation in the assembly System.Data.SqlServerCe could not be found. Ensure that the assembly System.Data.SqlServerCe is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use <qualifyAssembly/> element in the application configuration file to specify the full name of the assembly.
                      Source=NHibernate
                      StackTrace:
                           at NHibernate.Driver.ReflectionBasedDriver..ctor(String driverAssemblyName, String connectionTypeName, String commandTypeName)
                           at NHibernate.Driver.SqlServerCeDriver..ctor()
                      InnerException: 
InnerException:NHibernate.hibernateeException
Message=在程序集System.Data.SqlServerCe中找不到IDbCommand和IDbConnection实现。确保程序集System.Data.SqlServerCe位于应用程序目录或全局程序集缓存中。如果程序集位于GAC中,请使用应用程序配置文件中的元素指定程序集的全名。
来源=NHibernate
堆栈跟踪:
位于NHibernate.Driver.ReflectionBasedDriver..ctor(字符串驱动程序RassemblyName、字符串连接类型名称、字符串命令类型名称)
在NHibernate.Driver.SqlServerCeDriver..ctor()处
内部异常:
我正在使用最新的FluentNHibernate二进制文件。VS 2010,在Windows7x64上。我已经将System.Data.SqlServerCe程序集设置为“Copy Local”,将项目的目标平台更改为x86

fluent配置为:

var config  = Fluently.Configure()
                        .Database(MsSqlCeConfiguration.Standard.ShowSql().ConnectionString(cnxString))
                        .Mappings(m => m.FluentMappings.AddFromAssemblyOf<SyncContract>());

if (!File.Exists(dbPath))
{
     var engine = new System.Data.SqlServerCe.SqlCeEngine(cnxString);
     engine.CreateDatabase();

     config.ExposeConfiguration(c => new SchemaExport(c).Create(false, true));
}
return config;
var config=fluntly.Configure()
.Database(MsSqlCeConfiguration.Standard.ShowSql().ConnectionString(cnxString))
.Mappings(m=>m.FluentMappings.AddFromAssemblyOf());
如果(!File.Exists(dbPath))
{
var engine=new System.Data.SqlServerCe.SqlCeEngine(cnxString);
engine.CreateDatabase();
ExposeConfiguration(c=>newschemaexport(c.Create)(false,true));
}
返回配置;
注意:engine.CreateDatabase()工作正常

有什么帮助/想法吗?

好的,想好了


Copy Local不适用于我正在使用的测试项目,因此,LIB没有被复制到测试项目的bin文件夹中。将所有库添加为对测试项目的引用,并将其设置为“本地复制”以使其正常工作。

顺便说一句,我不需要将项目的目标设置为x86。我能够让代码针对“任何CPU”正常运行,我遇到了同样的问题。对于在TFS上运行的测试,“复制本地”不起作用。我必须使用添加所有更正库。