Skip to main content

Microsoft.CodeCoverage package brings infra for collecting code coverage from vstest.console.exe and "dotnet test".

Total Downloads
2.0B
1,969,972,774
Published
Oct 13, 2026
21d ago

Get Started

dotnet add package Microsoft.CodeCoverage --version 18.11.0

No framework information available.

README

Microsoft.CodeCoverage

Code coverage infrastructure for the Visual Studio Test Platform. This package enables collecting code coverage data from vstest.console.exe and dotnet test.

Usage

This package is typically referenced indirectly through Microsoft.NET.Test.Sdk. For standalone usage:

<PackageReference Include="Microsoft.CodeCoverage" Version="x.y.z" />

Collect code coverage during a test run:

dotnet test --collect "Code Coverage"

Published tests

dotnet publish places the collector, tools, and their private dependencies in the Microsoft.CodeCoverage subdirectory. Deploy the entire publish directory. VSTest's data collector host searches the test assembly's directory and its subdirectories, so it discovers the collector without a project or NuGet cache:

dotnet vstest publish/Tests.dll --collect:"Code Coverage"

For runners that require an explicit extension path, pass --TestAdapterPath:publish/Microsoft.CodeCoverage. Normal dotnet test runs continue to use the collector from the package directory.

When upgrading from a package that copied coverage files into the publish root, delete the old publish directory before publishing again. Old private dependencies in that directory cannot safely be distinguished from application files.

Links

Downloads by Version

Similar & Alternative Packages

Hand-picked matching NuGet libraries based on tags & ecosystem

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.