Skip to content

[BUG]: PublishTestResult gives misleading output about not being able to find .NET versions #21316

@ChristianStadelmann

Description

@ChristianStadelmann

New issue checklist

Task name

PublishTestResult

Task version

2

Issue Description

What happens:
The output is giving hints that a .NET SDK should be installed. However, the task continues to execute, so there is no need to install .NET SDK, everything else continues just fine.

What should happen:
No output, or only the version of .NET runtime or SDK installed. There was no problem, so we should not see any output that could be understood as an error.

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows 10 Enterprise LTSC 21H2

Relevant log output

Starting: Publish test results
==============================================================================
Task         : Publish Test Results
Description  : Publish test results to Azure Pipelines
Version      : 2.254.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/publish-test-results
==============================================================================
"C:\Program Files\dotnet\dotnet.exe" --version
The command could not be loaded, possibly because:
  * You intended to execute a .NET application:
      The application '--version' does not exist.
  * You intended to execute a .NET SDK command:
      No .NET SDKs were found.

Download a .NET SDK:
https://aka.ms/dotnet/download

Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found

Full task logs with system.debug enabled

(not relevant, as the issue can be clearly identified in the code: getDotNetVersion() in Tasks/PublishTestResultsV2/publishtestresults.ts calls the --version flag on the dotnet.exe, even if the option does not exist. Relevant code:

            dotnet = tl.tool(dotnetPath);
            dotnet.arg('--version');

Repro steps

  1. Have any agent with .NET runtime installed, but no .NET SDK
  2. Have any pipeline that uses PublishTestResults@2 task
  3. Run the pipeline
  4. Have a look at the output of the PublishTestResults@2 task

Additional information:
This logging output has been confusing developers in my organization, but also others, see #15579 for an example.

Please be aware that "C:\Program Files\dotnet\dotnet.exe" --version is only valid if an SDK is installed, otherwise it will error out. I recommend to use one of the following commands instead:

  • "C:\Program Files"\dotnet\dotnet.exe --list-sdks
  • "C:\Program Files"\dotnet\dotnet.exe --list-runtimes
  • "C:\Program Files"\dotnet\dotnet.exe --info

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions