2016-04-08 61 views
0

我有一个项目设置如下:Visual Studio团队服务测试无法找到DLL,但生成成功

  • ---解决方法A
  • ---溶液B
  • --- C液
  • ---包

我已经VSTS配置为共享一个共同的NuGet包在根目录中称为Packages的文件夹。所有这三种解决方案都创建nuget包作为输出,而解决方案C依赖于解决方案A的nuget包& B

我的VSTS构建成功完成,但单元测试项目找不到源项目引用。

测试过程中我得到的错误是:

Failed TestTracing 
Error Message: 
Test method Tracing.UnitTests.Tests.TestTracing threw exception: 
System.IO.FileLoadException: Could not load file or assembly 'Tracing, Version=1.0.0.19143, Culture=neutral, PublicKeyToken=8..' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 
Stack Trace: 
at Tracing.UnitTests.Tests.TestTracing() 

的tracing.csproj没有NuGet包的依赖关系。问题发生了,因为我在构建过程中构建和使用了相​​同的nuget包,还是缺少其他东西?

+0

在构建过程中生成了tracing.csproj吗?并且在您的单元测试项目\参考中,您是否已将“复制本地”设置为“true”以跟踪项目? –

回答

0

问题最终出现在VSTS构建定义的“Visual Studio Test”步骤中。我曾与下面的默认代码单步:

**\*test*.dll;-:**\obj\**; 

在输出这将产生vstest.console.exe的一次执行:

vstest.console.exe ".....\Tracing.dll" ".....\Solution B.dll" "....\Solution C.dll" 

的问题是,溶液B不得不参考一个不同版本的Tracing.dll,因此保证至少有一个项目无法加载dll。 (丑陋的)解决方案是为每个测试DLL打开一个实例的测试步骤。

相关问题