簡體   English   中英

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

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

我有一些使用NHibernate和SQLite的測試來測試內存中的數據庫組件。 測試可以在Visual Studio中正常運行,但是MSTest.exe控制台運行程序拒絕運行我的所有測試。 使用TeamCity的Build Server使用控制台運行程序來運行所有測試,並且我在計算機上使用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

任何想法如何進行呢? 謝謝 !

好的,最后我使用vstest.console.exe控制台運行程序來執行測試,並且可以正常工作。 (不知道那里出了什么問題)如果您有興趣將此跑步者與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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM