Visual Studio Team Services测试无法找到DLL,但构建成功

时间:2016-04-08 17:42:44

标签: azure-devops

我的项目设置如下:

  • ---解决方案A
  • ---解决方案B
  • ---解决方案C
  • ---包

我已将VSTS配置为在根目录中共享名为Packages的公共nuget包文件夹。所有三种解决方案都创建了nuget包作为输出,而解决方案C依赖于解决方案A& amp;中的nuget包。乙

我的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包,或者我错过了其他内容?

1 个答案:

答案 0 :(得分: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的一个实例来打破测试步骤。

相关问题