Verbose output of dotnet build is not shown on console for .NET 9.0.304 SDK without redirection
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 133
Description
### Describe the bug
When I use .NET 9.0.304 SDK to build projects using `dotnet build -v:d`, the verbose output is ignored and I see the same output as without the `-v:d` flag (same behavior with `dotnet build --verbosity detailed`), unless I redirect the output to a file.
When I change the SDK version to 8.0.413 with a `global.json`, the verbose output is displayed again.
Also if I redirect the output (`dotnet build -v:d > log.txt` or `dotnet build -v:d | more`) then the details are redirected.
Is this the expected behavior? If yes, maybe this should be documented in [dotnet build docs](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build) at `--verbosity`.
### To Reproduce
* Open a standard Windows Shell (cmd.exe), but the issue is the same also in powershell
* Create a folder and invoke `dotnet new console -f net8.0` (the .NET 8.0 is only needed so that I can test it with .NET 8 SDK, but the problem is independent of the project target)
* Invoke `dotnet new globaljson --sdk-version 9.0.304` to ensure the SDK version
* Invoke `dotnet build -v:d`
The result is:
```
C:\Temp\Test\bt2>dotnet build -v:d
Restore complete (0.2s)
Determining projects to restore...
All projects are up-to-date for restore.
bt2 succeeded (0.3s) → bin\Debug\net8.0\bt2.dll
Build succeeded in 0.8s
```
When I change the SDK version in `global.json` to "8.0.413" and invoke the same `dotnet build -v:d` again, I get:
```
Build started 8/29/2025 13:05:58.
0>Process = "C:\Program Files\dotnet\dotnet.exe"
MSBuild executable path = "C:\Program Files\dotnet\sdk\8.0.413\MSBuild.dll"
Command line arguments = "C:\Program Files\dotnet\sdk\8.0.413\MSBuild.dll -maxcpucount -verbosity:m -nologo -restore -consoleloggerparameters:Summary -verbosity:d -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,C:\Program Files\dotnet\sdk\8.0.413\dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,C:\Program Files\dotnet\sdk\8.0.413\dotnet.dll"
Current directory = "C:\Temp\Test\bt2"
MSBuild version = "17.11.38+901dc04e4"
[...]
1:7>Done Building Project "C:\Temp\Test\bt2\bt2.csproj" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.65
```
### Exceptions (if any)
n/a
### Further technical details
details of dotnet --info
.NET SDK:
Version: 8.0.413
Commit: a31823e79b
Workload version: 8.0.400-manifests.723ea284
MSBuild version: 17.11.38+901dc04e4
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.413\
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.
Host:
Version: 9.0.8
Architecture: x64
Commit: aae90fa090
.NET SDKs installed:
6.0.428 [C:\Program Files\dotnet\sdk]
7.0.410 [C:\Program Files\dotnet\sdk]
8.0.413 [C:\Program Files\dotnet\sdk]
9.0.304 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
C:\Temp\Test\bt2\global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the behavior in cmd.exe or PowerShell with `dotnet build -v:d`, comparing SDK 9.0.304 and 8.0.413 selected through `global.json`. Read the `dotnet build` documentation at `--verbosity` and investigate the console-versus-redirection difference; done means either the behavior is corrected and covered by a test, or the documented behavior clearly explains it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100