2014-12-02 51 views
2

我有一個使用實體框架在vb.net中編碼的單元測試項目。當我在Visual Studio上運行我的單元測試時,一切運行良好。當我嘗試在jenkins上部署我的單元測試時,出現以下錯誤。Jenkins引發的未知彙編錯誤

Run has the following issue(s): 
Warning: Test Run deployment issue: The assembly or module 'Microsoft.Practices.ServiceLocation' directly or indirectly referenced by the test container 'C:\Program Files\Jenkins\workspace\upstreambatchtests\bin\debug\upstreambatchtests.dll' was not found. 

我不知道這microsoft.practices.servicelocation是什麼,因爲我的應用程序沒有引用它。欣賞是否有人可以闡明它。

下面是我的詹金斯配置

"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" /testcontainer:MessageManagementLayer\UpstreamBatch\UpstreamBatchTests\bin\Debug\UpstreamBatchTests.dll /test:UpstreamBatchTests /resultsfile:UpstreamBatchTestsResults.trx 

回答

2

未在測試中使用的組件將不會被複制到測試文件夾中。所以,你有兩個選擇

  1. 一個裝飾添加到您的測試方法[DeploymentItem("MissingDll.dll")]其中MissingDll是編譯器請求您的DLL。

  2. 安裝DLL文件在你的機器的GAC代碼 在你的情況下運行

在缺少DLL是Microsoft.Practices.ServiceLocation.dll

所以你的裝飾應該是[DeploymentItem("Microsoft.Practices.ServiceLocation.dll")]

+0

喜faby,感謝您的回答,但僅僅爲了澄清一下,爲什麼需要microsoft.practices.servicelocation.dll – 2014-12-02 09:32:34

+0

,因爲您可能在項目中有一個參考,但當您創建單元測試時,它也不包含此參考 – faby 2014-12-02 09:39:29

+0

您是否嘗試過我的解決方案?它對你有幫助嗎? – faby 2014-12-02 10:17:06