Skip to content

dotnet test do not respect MSBUILDTERMINALLOGGER='auto' env variable. #38654

@tomwolanski

Description

@tomwolanski

Describe the bug

The automatic discovery whenever the new Terminal Logger can be used seems to have different behaviour between dotnet test and dotnet build.

To Reproduce

Create a new .Net 8 project with dotnet new console
Set the logger type to 'auto' $env:MSBUILDTERMINALLOGGER='auto'
Build it with dotnet build
Run tests with dotnet test (should run build as well)

Actual behavour:

When running dotnet build the new logger is used:

> $env:MSBUILDTERMINALLOGGER='auto'                                                                                                                                                                                                                                                                                                                                                                                
> dotnet build
MSBuild version 17.8.3+195e7f5a3 for .NET
Restore complete (0.3s)
   ltbug succeeded (1.2s) → bin\Debug\net8.0\ltbug.dll

Build succeeded in 2.0s

However when running dotnet test the old logger is used:

> $env:MSBUILDTERMINALLOGGER='auto'                                                                                                                                                                                                                                                                                                                                                                               
> dotnet test
Determining projects to restore...
All projects are up-to-date for restore.

The output is different when the new logger is enforced using the on option instead of auto:

> $env:MSBUILDTERMINALLOGGER='on'                                                                                                                                                                                                                                                                                                                                                                               
> dotnet test
Restore complete (0.3s)

Build succeeded in 0.7s

Expected behavour:

Since dotnet build detects that the new Terminal Logger can be used, dotnet test should also correcly detect it and use new logger.
I'd expect to see a new output like on the snippet below:

> $env:MSBUILDTERMINALLOGGER='auto'                                                                                                                                                                                                                                                                                                                                                                               
> dotnet test
Restore complete (0.3s)

Build succeeded in 0.7s

Further technical details

  • Dotnet version: 8.0.101
  • Windows Terminal version: 1.18.10301.0
  • PowerShell Core: 7.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions