Azure Pipelines VSTest task fails after Microsoft.NET.Test.Sdk is updated from 16.2 to 16.3
See original GitHub issueDescription
Starting with the most recent commit to my project Stein the CI build provided by Azure Pipelines fails. The build in question: https://dev.azure.com/nkristek/Stein/_build/results?buildId=148
Specifically the VSTest task fails with the error:
##[error]Testhost process exited with error: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'd:\a\1\s\test\Stein.ViewModels.Tests\bin\Release\netcoreapp2.1\'.
##[error]Failed to run as a self-contained app. If this should be a framework-dependent app, add the d:\a\1\s\test\Stein.ViewModels.Tests\bin\Release\netcoreapp2.1\testhost.runtimeconfig.json file specifying the appropriate framework.
Previously everything ran fine, this commit updated dependencies. Specifically the Microsoft.NET.Test.Sdk
was updated from 16.2 to 16.3.
I reran the previous commit with success: https://dev.azure.com/nkristek/Stein/_build/results?buildId=149
This seems to indicate that the new version of Microsoft.NET.Test.Sdk
produces this error.
Steps to reproduce
Run Azure Pipelines build with the following repository and settings: Repository: https://github.com/nkristek/Stein Configuration: https://github.com/nkristek/Stein/blob/master/azure-pipelines.yml
Expected behavior
The VSTest task succeeds.
Actual behavior
The VSTest task fails with the error:
##[error]Testhost process exited with error: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'd:\a\1\s\test\Stein.ViewModels.Tests\bin\Release\netcoreapp2.1\'.
##[error]Failed to run as a self-contained app. If this should be a framework-dependent app, add the d:\a\1\s\test\Stein.ViewModels.Tests\bin\Release\netcoreapp2.1\testhost.runtimeconfig.json file specifying the appropriate framework.
Diagnostic logs
Please share test platform diagnostics logs. Instructions to collect logs are here.
The logs may contain test assembly paths, kindly review and mask those before sharing.
Environment
Configuration: https://github.com/nkristek/Stein/blob/master/azure-pipelines.yml:
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
pool:
vmImage: 'VS2017-Win2016'
variables:
solution: '**/*.sln'
strategy:
maxParallel: 2
matrix:
x86:
buildPlatform: 'x86'
buildConfiguration: 'Release'
x64:
buildPlatform: 'x64'
buildConfiguration: 'Release'
steps:
- task: DotNetCoreInstaller@0
displayName: 'Install .NET Core 2.1'
inputs:
version: '2.1.300'
- task: NuGetToolInstaller@1
displayName: 'Install NuGet'
- task: NuGetCommand@2
displayName: 'Restore NuGet packages'
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
displayName: 'Build'
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
clean: true
- task: VSTest@2
displayName: 'Test'
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
codeCoverageEnabled: true
runSettingsFile: '$(Build.SourcesDirectory)\test\test.runsettings'
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (1 by maintainers)
@nkristek we have identified this issue, & it’s happening because in the latest SDK we also drop testhost.dll along with the test assembly. Now since your test filter says to pick any test..dll we also try to run test for testhost.dll which is failing abruptly. We apologize for this, & we have already raised a PR to fix this https://github.com/microsoft/vstest/pull/2206
To help you mitigate it for now we recommend that you either downgrade the SDK version, or modify your test filter to exclude testhost*.
Yes I updated to newest version. It is working fine
On Tue, 4 Aug, 2020, 7:33 PM Rob Smitha, notifications@github.com wrote: