'VSTest Task running v1 when v2 expected, vstestLocation ignored
I'm trying to use Azure Pipelines to build a class library. My azure-pipelines.yml
looks like this:
variables:
solution: 'MySolution.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
pool:
vmImage: 'VS2017-Win2016'
steps:
- task: NuGetToolInstaller@0
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
vstestLocation: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
codeCoverageEnabled: true
otherConsoleOptions: '/Framework:FrameworkCore10'
However, the task runs from a different location, and judging by that it seems to be Test Platform v1 (TP v1): C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe
. Judging from the Github issues for azure-pipelines-tasks, it seems that they shipped TP v2 sometime earlier this year (2018).
How can I make sure I'm actually using TP v2?
Update: I've now opened an issue on the pipelines github repo: Microsoft/azure-pipelines-tasks#8911
Solution 1:[1]
The reason the Location doesn't use the correct location is because vstestLocation
needs the vstestLocationMethod=location
argument as well. Otherwise the default value version
is used.
However, when those arguments are specified, instead of packaging the list of tested binaries, it seems to expand them into the command line, which might cause a ##[error]Error: spawn ENAMETOOLONG
if the binaries' names form a string that is too long.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | DigCamara |