azure-pipelines-tasks: PublishCodeCoverageResults@2 fails when .Net Core 2.1 is not installed

When using the latest version in an agent that has .net6 and .net7 SDK installed this error is observed:

==============================================================================
Task         : Publish code coverage results
Description  : Publish any of the code coverage results from a build
Version      : 2.215.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/publish-code-coverage-results
==============================================================================
Found 1 result(s) matching pattern: D:\a\_work\_temp/Cobertura.xml
D:\a\_work\_temp\Cobertura.xml
"C:\hostedtoolcache\windows\dotnet\dotnet.exe" D:\a\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.215.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.dll "D:\a\_work\_temp\Cobertura.xml" --reportDirectory D:\a\_work\_temp\71b24c1a-5997-47df-a89a-df6e00a99de7
You must install or update
 .NET to run this application.

App: D:\a\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.215.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '2.1.0' (x64)
.NET location: C:\hostedtoolcache\windows\dotnet\

The following frameworks were found:
  6.0.5 at [C:\hostedtoolcache\windows\dotnet\shared
\Microsoft.NETCore.App]
  6.0.13 at [C:\hostedtoolcache\windows\dotnet\shared\Microsoft.NETCore.App]
  7.0.2 at [C:\hostedtoolcache\windows\dotnet\shared\Microsoft.NETCore.App]

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 18 (9 by maintainers)

Most upvoted comments

Why is this issue closed? Wouldn’t it be better when the .net core sdk 2.1.x requirement is unnecessary? The V1 task runs without any special dependency after all.

This task works correctly on using the .net core 2.1.x before. Please use the same.

Please use the .net core task before Publish Code Coverage v2. We have added the same in the public documentation : https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/publish-code-coverage-results-v2?view=azure-pipelines