我有一个使用实体框架在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
答案 0 :(得分:2)
未在测试中使用的程序集将不会复制到测试文件夹。所以你有两个选择
在测试方法[DeploymentItem("MissingDll.dll")]
中添加一个装饰器,其中MissingDll
是编译器请求你的dll。
将dll文件安装在代码所在机器的GAC中 运行
在您的情况下,丢失的dll为Microsoft.Practices.ServiceLocation.dll
所以你的装饰者应该是[DeploymentItem("Microsoft.Practices.ServiceLocation.dll")]