Skip to content

/noconsolelogger is an MSBuild flag and causes problems with dotnet test #171

@pjt33

Description

@pjt33

The arguments passed to dotnet test unconditionally include /noconsolelogger:

When that argument was first added, back in a7ff6840, it was guarded by a conditional and intended for MSBuild 15.0, and -noconsolelogger is still listed in the MSBuild docs. But we've found that when we port our unit tests to TUnit and want to invoke dotnet test with MTP using a dotnet step with command test then this argument aborts the testing:

Starting: .NET SDK 10.0.103 "C:\Program Files\dotnet\dotnet.exe" test --configuration Release --no-build @C:\TeamCity\buildAgent\temp\agentTmp\2.rsp --report-trx
15:49:58     in directory: C:\TeamCity\buildAgent\work\80a095a6e7c83ab8
15:49:59     C:\TeamCity\buildAgent\work\80a095a6e7c83ab8\tests\<elided>\bin\Release\net10.0\<elided>.dll (net10.0) Zero tests ran
15:49:59     Exit code: 5
15:49:59       Standard output: Tool '/noconsolelogger' not found in the list of registered tools.
15:49:59       Usage <elided>.exe [option providers] [extension option providers]

(snip the full list of supported arguments).

Our global.json is simply:

{
    "test": {
        "runner": "Microsoft.Testing.Platform"
    }
}

It seems that the argument needs to regain a conditional guard so that it's only included when testing with MSBuild rather than dotnet test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions