visual studio 2012 MSTest.exe无法加载ADO.NET提供程序SQLite& NHibernate的

时间:2013-11-08 16:53:42

标签: c# sqlite nhibernate visual-studio-2012 mstest

我有一些测试使用NHibernate和SQLite来测试内存中的数据库组件。 测试工作室中的测试运行良好,但是MSTest.exe控制台运行器拒绝运行我的所有测试。控制器运行程序由构建服务器使用,该服务器使用TeamCity运行所有测试,我使用机器上的MSTest.exe查看本地控制台运行程序也失败。

我有这个内在的例外:

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

大多数回答者包括向App.config添加正确的参考程序集到sqlite,但测试项目是一个类库。

在我的测试项目中,我引用了以下程序集:

  • NHibernate 3.3.1.4000
  • 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 \,我更改了指向v2.0文件夹的默认引用,并且不会在构建服务器上运行测试因为以下错误,虽然它仍然可以在visual studio中正常运行:
  

ClassInitialize有错误的签名。参数1的类型应为Microsoft.VisualStudio.TestTools.UnitTesting.TestContext

我使用以下工具:

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

知道如何继续这个吗? 谢谢!

1 个答案:

答案 0 :(得分:0)

好的,最后我使用vstest.console.exe控制台运行程序来执行测试,它确实有效。 (不知道那里出了什么问题) 如果你有兴趣将这个跑步者与Teamcity联系起来,那就读得很好: http://blog.dontpaniclabs.com/post/2013/06/13/TeamCity-Builds-with-the-Visual-Studio-2012-Test-Runner