dotnet / dotnet/sdk

Broken Test output when specifying `-tl:off` in `Directory.Build.rsp`

Open
#50,441 5 comments 0 reactions 1 assignee Claimed by @MichalPavlik View on GitHub
Area-dotnet test Area-dotnet test (VSTest)
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug
MSBuild supports a `Directory.Build.rsp` convention for adding properties to MSBuild.

When using this to specify `-tl:off` it works for most cases, except for `dotnet test`. In that case only part of the test output is seen (only for a single target framework of a multi-targeted project).

This has been impacting dotnet/runtime for some time. It would be nice to have a happy path for folks running tests in our repo. Either with the terminal logger or without. See https://github.com/dotnet/runtime/issues/94183

### To Reproduce
Create a test project that multi-targets.
Add a `Directory.Build.rsp` with `-tl:off`
run `dotnet test` on the project.

[xunitTest.zip](https://github.com/user-attachments/files/21943644/xunitTest.zip)

### Exceptions (if any)
None

### Further technical details
Issue appears to be here -- https://github.com/dotnet/sdk/blob/55044e9a14e10600c07dcb22ea669b5faad890fc/src/Cli/dotnet/Commands/Test/TestCommand.cs#L102

To fix it, I think the SDK would need to crack the RSP.

I tried to workaround it by also specifying `VsTestUseMSBuildOutput=false` in the RSP but this is ignored (rightly) since MSBuild prioritizes the command line arguments over the RSP. I also tried to specify in a props with TreatAsLocal, but it didn't seem to help. I did find that specifying `/p:VsTestUseMSBuildOutput=true` on the commandline (with RSP in place) would work, and behave similarly to `/tl:off` on the commandline, so that makes me wonder if https://github.com/dotnet/sdk/blob/55044e9a14e10600c07dcb22ea669b5faad890fc/src/Cli/dotnet/Commands/Test/TestCommand.cs#L117-L125 is still needed.

I do see that https://github.com/Microsoft/vstest/issues/1503 is resolved, so maybe SDK can just delete this workaround?

@nohwnd @baronfel

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.