This guide assumes there is a Build Configuration (e.g. named "Tests + dotCover") building a .NET project and running tests with dotCover enabled (one or several build steps):
1. Create another Build Configuration (e.g. named "Send to SonarQube") and add the following 2 dependencies on initial configuration ("Tests + dotCover"):
a) A snapshot dependency
b) An artifact dependency for "
.teamcity/.NETCoverage/dotCover.dcvr" file and getting artifacts from "Build from the same chain".
Note: since TeamCity version 2019.1, dotCover.dcvr is no longer a hidden artifact that is published by default. It is now created in the build temporary folder ("
%system.teamcity.build.tempDir%\..\agentTmp\dotNetCoverageResults\dotCover.dcvr") and removed when the build finishes. To enable publishing of this artifact, specify the path to the
.dcvr file explicitly in the Artifacts paths of a build configuration.
2. In the new configuration ("Send to SonarQube") add a Command Line step with the following script:
%teamcity.dotCover.home%\dotCover.exe report /ReportType=HTML /Source="dotCover.dcvr" /Output="dotCover.html"
3. Add SonarQube Runner to the new configuration and add an additional command line argument with "
After the last build step with enabled dotCover, add a new step to merge all the collected coverage into a single XML in a well-known place as described here.