From bbf2375652b0ba3f9b7a60442b2c942ee3beb347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 7 Jul 2026 03:22:19 +0200 Subject: [PATCH] Fix test output eaten by MSBuild terminal logger when TestCaptureOutput=false When TestCaptureOutput=false (set in Directory.Build.props to show test output live) and the MSBuild terminal logger is active, the terminal logger buffers all MSBuild subprocess output and shows 'See log file: ' messages at the end. Since TestCaptureOutput=false means no log files are created, these paths point to files that don't exist, leaving developers with no test output. Fix: disable the MSBuild terminal logger in test.sh and test.cmd by default via the MSBUILDTERMINALLOGGER environment variable. Developers who prefer the terminal logger UI can override this by setting MSBUILDTERMINALLOGGER=auto before invoking the test scripts. Fixes #15509 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- test.cmd | 1 + test.sh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/test.cmd b/test.cmd index c879b9d2c3..8045e25dc3 100644 --- a/test.cmd +++ b/test.cmd @@ -1,3 +1,4 @@ @echo off +if not defined MSBUILDTERMINALLOGGER set MSBUILDTERMINALLOGGER=off powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\Build.ps1""" -test %*" exit /b %ErrorLevel% diff --git a/test.sh b/test.sh index 7f61c8be87..1cb02b0090 100755 --- a/test.sh +++ b/test.sh @@ -16,4 +16,8 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" if [[ -z "${DOTNET_ROOT:-}" && -d "$scriptroot/.dotnet" ]]; then export DOTNET_ROOT="$scriptroot/.dotnet" fi +# Disable MSBuild terminal logger so test output isn't buffered. TestCaptureOutput=false +# means there are no log files to reference, so the terminal logger would show +# misleading "See log file" messages with paths to files that don't exist. +export MSBUILDTERMINALLOGGER=${MSBUILDTERMINALLOGGER:-off} "$scriptroot/eng/common/build.sh" --test "$@"