Codebelt
v10.0.1

Coverlet MTP API

Microsoft Testing Platform coverage that respects multi-targeted .NET test estates.

1 NuGet package .NET 10.0 / .NET 9.0 / .NET Standard 2.0 MIT 1,374 downloads

Overview

This repository publishes one package, Codebelt.Coverlet.MTP, and keeps Coverlet's Microsoft Testing Platform integration recognizable while narrowing its packaging contract around a specific problem: collecting code coverage in test estates that do not live on one target framework. The package preserves MTP extension discovery through the coverlet.MTP.dll assembly and the Coverlet.MTP.TestingPlatformBuilderHook registration point, but it ships explicit target-specific assets and dependency groups for netstandard2.0, net9.0, and net10.0.

That choice matters because coverage tooling is not just a runtime detail. It participates in restore, build, instrumentation, and test-host startup for every target framework in a solution. When a repository mixes current .NET TFMs or still keeps a compatibility floor, framework-aligned dependency groups reduce friction that a flattened "latest runtime everywhere" package shape can introduce.

Concepts

Explicit multi-TFM dependency groups

Codebelt.Coverlet.MTP does not treat multi-targeting as a badge. The package project declares separate dependency groups for netstandard2.0, net9.0, and net10.0, and the repository's central package versions pin Microsoft.Extensions.* and System.* dependencies to the generation that matches the active target framework. netstandard2.0 keeps its own explicit 8.0.x overrides, while net9.0 and net10.0 consume their matching runtime generation.

The benefit is easy to miss until a test repository starts targeting more than one framework. Coverage extensions run close to the build and test host, so dependency mismatches show up early. Keeping each TFM group explicit lets one package reference fit mixed-target MTP projects without assuming the newest runtime generation should govern every restore graph.

MTP discovery stays compatible

The package changes the NuGet identity to Codebelt.Coverlet.MTP, but it deliberately keeps the implementation assembly name coverlet.MTP.dll. Its build-transitive props still register Coverlet.MTP.TestingPlatformBuilderHook, and its build targets point MTP at the TFM-specific extension assembly under lib\$(TargetFramework).

That is a compatibility choice, not a rewrite for rewrite's sake. Existing Microsoft Testing Platform discovery continues to look like Coverlet, while the package identity and dependency layout reflect the Codebelt-maintained scope.

Coverage collection is split across controller and test-host processes

The integration is shaped around MTP's execution model. CoverletExtensionProvider registers out-of-process controllers that instrument assemblies before the test host starts, plus in-process handlers that flush module tracker data when the session ends. The same package also contributes the --coverlet* command-line surface and configuration-file parsing for testconfig.json or coverlet.mtp.appsettings.json.

That split matters because instrumentation and result emission do not happen at the same point in MTP's lifecycle. The package keeps those responsibilities separate so coverage can be prepared before the test host locks files and finalized after the test session completes.

Usage guidance

Use this family when your tests already run on Microsoft Testing Platform and the repository targets more than one framework, or may need to again later. The explicit multi-TFM packaging is the point: it keeps coverage support aligned to each target instead of forcing one runtime generation through every test project in the solution.

If you need Coverlet drivers outside this repository's scope - the console tool, the VSTest collector, or the MSBuild integration - use the upstream Coverlet packages and docs. This fork is intentionally narrow and stays respectful of that broader upstream surface rather than trying to replace it.

Family packages