Skip to content

How to get MSBuild binary logs from MTP with dotnet test? #6719

Closed as not planned

Description

I have a custom MSBuild target that I call ReportGenerator with, which is defined with AfterTargets="InvokeTestingPlatform", but it isn't firing.

I tried to debug this with an MSBuild binary log, but the log doesn't appear to contain any trace of the InvokeTestingPlatform target.

I ran dotnet test -bl, which generates msbuild.binlog and msbuild-dotnet-test.binlog, but neither find the InvokeTestingPlatform target in it, but I know it's running as I can see the effects of another target I have that is defined with BeforeTargets="_MTPAddArguments;InvokeTestingPlatform".

I can see the MTP build in msbuild.binlog:

Image

But msbuild-dotnet-test.binlog doesn't appear to contain anything other than evaluation:

Image

Activity

  1. Youssef1313 commented on Oct 10, 2025

    @Youssef1313
    Member

    If you are talking about the MTP-based dotnet test that is shipping in .NET 10, we don't invoke any MSBuild targets for running tests. The whole logic is embedded in the dotnet(.exe) process where we start the test app as child processes. Collecting coverage via MSBuild is unfortunately not supported.

  2. added
    external/dotnet-test
    and removed
    needs/triage
    on Oct 10, 2025
  3. martincostello commented on Oct 10, 2025

    @martincostello
    ContributorAuthor

    I'm confused - I use MSBuild targets to customise the arguments to MTP before it's invoked...

    I just made a change to them to double check:

    Image
  4. Youssef1313 commented on Oct 10, 2025

    @Youssef1313
    Member

    _MTPAddArguments is run (we do it programmatically here), but not InvokeTestingPlatform. The actual test execution doesn't happen via any targets.

  5. martincostello commented on Oct 10, 2025

    @martincostello
    ContributorAuthor

    Ah, that explains why I just need to make this change to add _MTPAddArguments: martincostello/build-kit@0f225e0

    So basically my whole MSBuild customization setup is junked by MTP v2?

  6. martincostello commented on Oct 10, 2025

    @martincostello
    ContributorAuthor

    Collecting coverage via MSBuild is unfortunately not supported.

    For clarity, I'm not collecting coverage - I'm running ReportGenerator to post-process the output from the tests to generate human-readable reports.

  7. Youssef1313 commented on Oct 10, 2025

    @Youssef1313
    Member

    fwiw, for adjusting TestingPlatformCommandLineArguments, it's better to not rely on _MTPAddArguments and use ComputeRunArguments instead.

    For ReportGenerator, we need to discuss internally how to best move forward here. The initial plan was to not have any MSBuild hooks here for dotnet test. FYI Jakub Jareš (@nohwnd) Chet Husk (@baronfel) Mariam Abdullah (@mariam-abdulla)

  8. Evangelink commented on May 28, 2026

    @Evangelink
    Member

    Given we are not using MSBUild tasks to run tests, this would require a large re-engineering. Given we have limited resource and there aren't many requests so far, I'll move forward as won't fix.

    We will obviously reconsider if something changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    external/dotnet-test

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions