Jenkins抛出的未知程序集错误

时间:2014-12-02 09:02:18

标签: vb.net entity-framework jenkins unit-testing

我有一个使用实体框架在vb.net中编码的单元测试项目。当我在visual studio上运行我的单元测试时,一切运行正常。当我尝试在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是什么,因为我的应用程序没有对它的引用。感谢是否有人可以了解它。

以下是我的jenkins配置

"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 

1 个答案:

答案 0 :(得分:2)

未在测试中使用的程序集将不会复制到测试文件夹。所以你有两个选择

  1. 在测试方法[DeploymentItem("MissingDll.dll")]中添加一个装饰器,其中MissingDll是编译器请求你的dll。

  2. 将dll文件安装在代码所在机器的GAC中 运行

  3. 在您的情况下,丢失的dll为Microsoft.Practices.ServiceLocation.dll

    所以你的装饰者应该是[DeploymentItem("Microsoft.Practices.ServiceLocation.dll")]