coverlet.msbuild 1.0.0

There is a newer version of this package available.
See the version list below for details.
Install-Package coverlet.msbuild -Version 1.0.0
dotnet add package coverlet.msbuild --version 1.0.0
<PackageReference Include="coverlet.msbuild" Version="1.0.0">
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add coverlet.msbuild --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: coverlet.msbuild, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install coverlet.msbuild as a Cake Addin
#addin nuget:?package=coverlet.msbuild&version=1.0.0

// Install coverlet.msbuild as a Cake Tool
#tool nuget:?package=coverlet.msbuild&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Build Status Build status Coverage Status License: MIT


Coverlet is a cross platform code coverage library for .NET Core, with support for line and method coverage.


Available on NuGet

Visual Studio:

PM> Install-Package coverlet.msbuild

.NET Core CLI:

dotnet add package coverlet.msbuild

How It Works

Coverlet integrates with the MSBuild system and that allows it to go through the following process:

Before Tests Run

  • Locate the unit test assembly and selects all the referenced assemblies that have PDBs.
  • Instruments the selected assemblies by inserting code to record sequence point hits to a temporary file.

After Tests Run

  • Restore the original non-instrumented assembly files.
  • Read the recorded hits information from the temporary file.
  • Generate the coverage result from the hits information and write it to a file.


Coverlet deosn't require any additional setup other than including the NuGet package. It integrates with the dotnet test infrastructure built into the .NET Core CLI and when enabled will automatically generate coverage results after tests are run.

Code Coverage

Enabling code coverage is as simple as setting the CollectCoverage property to true

dotnet test /p:CollectCoverage=true

After the above command is run, a coverage.json file containing the results will be generated in the root directory of the test project. A summary of the results will also be displayed in the terminal.

Coverage Output

Coverlet can generate coverage results in multiple formats, which is specified using the CoverletOutputFormat property. Possible values include json (default), lcov and opencover. For example, the following command emits coverage results in the opencover format:

dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

The output folder of the coverage result file can also be specified using the CoverletOutputDirectory property.


  • Branch coverage
  • Console runner (removes the need for requiring a NuGet package)

Issues & Contributions

If you find a bug or have a feature request, please report them at this repository's issues section. Contributions are highly welcome, however, except for very small changes, kindly file an issue and let's have a discussion before you open a pull request.


This project is licensed under the MIT license. See the LICENSE file for more info.

This package has no dependencies.

NuGet packages (13)

Showing the top 5 NuGet packages that depend on coverlet.msbuild:

Package Downloads

Package Description


Package Description


Simple to use CQRS library.


A logging decorator for the Klinked.Cqrs library that makes it easy to add logging to all commands, events, and queries.


A simple library aimed at bringing Gherkin style tests to xUnit. Usage of the library is similar to SpecFlow.

GitHub repositories (176)

Showing the top 5 popular GitHub repositories that depend on coverlet.msbuild:

Repository Stars
ML.NET is an open source and cross-platform machine learning framework for .NET.
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
API Support for your favorite torrent trackers
GraphQL for .NET
Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. Project Tye includes a local orchestrator to make developing microservices easier and the ability to deploy microservices to Kubernetes with minimal configuration.
Version Downloads Last updated
3.1.0 753,536 7/19/2021
3.0.3 3,886,781 2/21/2021
3.0.2 1,102,182 1/24/2021
3.0.1 296,617 1/16/2021
3.0.0 211,113 1/9/2021
2.9.0 9,889,082 5/30/2020
2.8.1 3,286,992 4/2/2020
2.8.0 4,902,157 1/3/2020
2.7.0 3,587,268 9/22/2019
2.6.3 2,129,917 7/1/2019
2.6.2 588,427 6/6/2019
2.6.1 952,430 5/8/2019
2.6.0 989,763 3/4/2019
2.5.1 2,083,254 1/17/2019
2.5.0 468,324 12/20/2018
2.4.0 852,964 11/28/2018
2.3.2 246,075 11/19/2018
2.3.1 644,316 10/16/2018
2.3.0 765,665 9/7/2018
2.2.1 430,748 8/11/2018
2.1.1 321,640 7/16/2018
2.1.0 136,038 7/6/2018
2.0.1 331,035 6/12/2018
2.0.0 87,109 5/17/2018
1.2.0 96,850 5/2/2018
1.1.1 49,237 4/17/2018
1.1.0 3,492 4/16/2018
1.0.2 37,210 4/2/2018
1.0.1 10,877 3/26/2018
1.0.0 8,102 3/21/2018