Skip to content

Instantly share code, notes, and snippets.



Created Sep 12, 2019
What would you like to do?
Example Makefile for building a coverage report for .Net Core 2.2 projects on Windows 10 in MSYS2/Bash
# --------------------------------------------------------------------------------
# This script uses the coverlet tool to generate code coverage statistics about the tests
# For more info about coverlet:
# Author: Samuel Lampa
# --------------------------------------------------------------------------------
echo "Installing any uninstalled dependencies, by executing dotnet restore ..."
dotnet restore
dotnet build
coverage.opencover.xml: ./bin/Debug/netcoreapp2.2/MyApp.Tests.dll
coverlet $< --target dotnet --targetargs "test --no-build" --format opencover;
covreport/index.htm: coverage.opencover.xml
/c/Users/${USER}/.nuget/packages/reportgenerator/4.0.14/tools/net47/ReportGenerator.exe "-reports:$<" "-targetdir:covreport" "-reporttypes:Html";
build-covxml: coverage.opencover.xml
build-coverage: covreport/index.htm
show-coverage: covreport/index.htm
echo "Now trying to open the report in the Brave browser (if it doesn't work, you probably don't have Brave installed)";
/c/Program\ Files\ \(x86\)/BraveSoftware/Brave-Browser/Application/brave.exe "$<"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.