Azure-DevOps 管道因 testhost.dll 而失败
Azure-DevOps Pipeline fails because of testhost.dll
我的 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 Files\dotnet'.
##[error]. Please check the diagnostic logs for more information.
按照建议 here,我为 testhost.dll
添加了一个额外的过滤器,所以我的 yaml-snippet 看起来像这样:
- 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
但是,错误仍然存在,我的构建被标记为失败。
我该如何解决这个问题?
这篇 GitHub issue 希望能有所帮助。
要尝试的事情:
- 删除一个测试程序集对另一个程序集的引用
- 更新 Microsoft.NET.Test.SDK 至 16.6.1
- 添加一个 application.runtimeconfig.json 文件
希望对您有所帮助!
我的 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 Files\dotnet'.
##[error]. Please check the diagnostic logs for more information.
按照建议 here,我为 testhost.dll
添加了一个额外的过滤器,所以我的 yaml-snippet 看起来像这样:
- 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
但是,错误仍然存在,我的构建被标记为失败。 我该如何解决这个问题?
这篇 GitHub issue 希望能有所帮助。
要尝试的事情:
- 删除一个测试程序集对另一个程序集的引用
- 更新 Microsoft.NET.Test.SDK 至 16.6.1
- 添加一个 application.runtimeconfig.json 文件
希望对您有所帮助!