简体   繁体   English

visual Studio 2012 MSTest.exe无法加载ADO.NET提供程序SQLite和NHibernate

[英]visual studio 2012 MSTest.exe cannot load ADO.NET provider SQLite & NHibernate

I have some tests that use NHibernate and SQLite to test in-memory my database components. 我有一些使用NHibernate和SQLite的测试来测试内存中的数据库组件。 The tests run fine in visual studio, however the MSTest.exe console runner refuse to run all my tests. 测试可以在Visual Studio中正常运行,但是MSTest.exe控制台运行程序拒绝运行我的所有测试。 The console runner is used by the Build Server that uses TeamCity to run all the tests, and I use the MSTest.exe on my machine to see that the local console runner also fails. 使用TeamCity的Build Server使用控制台运行程序来运行所有测试,并且我在计算机上使用MSTest.exe来查看本地控制台运行程序也失败。

I have this inner exception : 我有这个内部异常:

NHibernate.HibernateException: Could not create the driver fromNHibernate.Driver.SQLite20Driver, NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed

Most answsers to this include adding to App.config the correct reference assembly to sqlite, however the test project is a class library. 大多数对此的答复包括将正确的引用程序集添加到App.config中,以供sqlite使用,但是测试项目是一个类库。

On my test project I have referenced the following assemblies : 在我的测试项目中,我引用了以下程序集:

  • NHibernate 3.3.1.4000 NHibernate的3.3.1.4000
  • System.Data.SQLite (x86, x64) 1.0.89.0 System.Data.SQLite(x86,x64)1.0.89.0
  • Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 10.0.0.0 (C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\ReferenceAssemblies\\v4.0\\, I changed the default reference that pointed to the v2.0 folder and wouldn't run the tests on the build server because of the following error, though it would still run fine in visual studio : Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 10.0.0.0(C:\\ Program Files(x86)\\ Microsoft Visual Studio 11.0 \\ Common7 \\ IDE \\ ReferenceAssemblies \\ v4.0 \\,我更改了指向v2.0的默认引用文件夹,并且由于以下错误而不会在构建服务器上运行测试,尽管它在visual studio中仍然可以正常运行:

ClassInitialize has wrong signature. ClassInitialize的签名错误。 Parameter 1 should be of type Microsoft.VisualStudio.TestTools.UnitTesting.TestContext 参数1的类型应为Microsoft.VisualStudio.TestTools.UnitTesting.TestContext

I use the following tools : 我使用以下工具:

  • MSTest.exe (C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\MSTest.exe) MSTest.exe(C:\\ Program Files(x86)\\ Microsoft Visual Studio 11.0 \\ Common7 \\ IDE \\ MSTest.exe)
  • .NET Framework 4.0 .NET Framework 4.0
  • Visual Studio 2012 Visual Studio 2012

Any idea how to proceed on this? 任何想法如何进行呢? Thanks ! 谢谢 !

Ok so finally I use the vstest.console.exe console runner to execute tests, and it works. 好的,最后我使用vstest.console.exe控制台运行程序来执行测试,并且可以正常工作。 (No idea what went wrong in there) If you're interested in coupling this runner with Teamcity, there's a good read : http://blog.dontpaniclabs.com/post/2013/06/13/TeamCity-Builds-with-the-Visual-Studio-2012-Test-Runner (不知道那里出了什么问题)如果您有兴趣将此跑步者与Teamcity结合使用,请阅读以下文章: http ://blog.dontpaniclabs.com/post/2013/06/13/TeamCity-Builds-with- -Visual-Studio-2012-Test-Runner

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法为NHibernate加载自定义ADO.NET提供程序 - Unable to load Custom ADO.NET provider for NHibernate Visual Studio 2015中针对Firebird的ADO.NET数据提供程序 - ADO.NET Data provider for Firebird in Visual Studio 2015 在Visual Studio 2015中缺少sqlite的ADO.NET数据源 - Missing ADO.NET data source for sqlite in Visual Studio 2015 无法在非开发计算机上加载System.Data.SQLite ADO.NET Provider - System.Data.SQLite ADO.NET Provider cannot be loaded on non development machine 在Visual Studio 2012中,何时添加ADO.NET实体数据模型(* .edmx)? - In Visual Studio 2012, when you add an ADO.NET Entity Data Model (*.edmx)? 无法加载ado.net MySQL - Cannot load ado.net MySQL visual Studio 2015更新1未注册或无法加载Oracle ADO.NET提供程序 - visual studio 2015 update 1 Oracle ADO.NET provider is either not registered, or could not be loaded 安装和使用System.Data.SQLite(一个ADO.NET提供程序) - Installing and Using System.Data.SQLite (An ADO.NET provider) 如何自定义 MSTest.exe? - How to customize MSTest.exe? 在Visual Studio 2012 RC中看不到Oracle Data Provider for .NET - Cannot see Oracle Data Provider for .NET in Visual Studio 2012 RC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM