Testing Azure DevOps管道因testhost.dll而失败
我的azure devops测试管道遇到一些问题。 我使用的是xunit测试,每个测试项目都正常运行,我可以查看测试结果,但由于以下错误,管道仍然失败Testing Azure DevOps管道因testhost.dll而失败,testing,azure-devops,xunit,Testing,Azure Devops,Xunit,我的azure 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 File
##[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.
正如建议的那样,我为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
但是,错误仍然发生,并且我的生成被标记为失败。
我该如何解决这个问题?希望这会有所帮助
尝试的事项:
- 删除从一个测试程序集到另一个测试程序集的引用
- 将Microsoft.NET.Test.SDK更新为16.6.1
- 添加application.runtimeconfig.json文件
希望这有帮助 有没有办法排除
testSelector
的testhost.dll
:testPlan
而不是testSelector
:testAssemblies