Azure-DevOps管道由于testhost.dll而失败

问题描述 投票:0回答:1

我的天蓝色devops测试管道遇到了一些麻烦。我正在使用xunit测试,并且每个测试项目都可以正确运行,并且可以查看测试结果,但是由于以下错误,管道仍然会失败

##[error]Testhost process exited with error: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet'.
##[error]. Please check the diagnostic logs for more information.

就像建议的here,我为testhost.dll添加了一个额外的过滤器,因此我的yaml代码段如下所示:

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
    testSelector: 'testAssemblies'
    testAssemblyVer2: |
      **\*test.dll
      !**\*TestAdapter.dll
      !**\obj\**
      !**\testhost.dll
      !*testhost.dll
    searchFolder: '$(System.DefaultWorkingDirectory)'
    diagnosticsEnabled: true
    codeCoverageEnabled: true

但是,错误仍然发生,我的构建被标记为失败。我该如何解决?

testing azure-devops xunit
1个回答
0
投票

希望此GitHub issue应该有所帮助。

尝试的事情:

  • 将参考从一个测试程序集删除到另一个]
  • 将Microsoft.NET.Test.SDK更新为16.6.1
  • 添加一个application.runtimeconfig.json文件
  • 希望这会有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.