dotCover-Reports and TFS
See original GitHub issueI’m trying to get code coverage working for our TFS-based CI build. As coverage tool I’m using JetBrains’ dotCover, which appears to work fine. Now, I want to publish that coverage on the TFS. MS provides the build task “Publish Code Coverage Report” which supports Cobertura and JaCoCo coverage files.
Thus, I would like to use the ReportGenerator task to convert the given coverage file into Cobertura format - how do I do this? 😃
I have configured the ReportGenerator task as follows:
- Reports: Path to coverage file as produced by dotCover
- Target directory: Path to some directory from where I want to pick up the Cobertura coverage file by the mentioned “Publish Code Coverage” task
- Report types: Cobertura
The output of the build server is as follows:
==============================================================================
Task : ReportGenerator
Description : ReportGenerator converts XML reports generated by OpenCover, PartCover, dotCover, Visual Studio, NCover, Cobertura or JaCoCo into human readable reports in various formats.
Version : 1.0.3
Author : Palmmedia
Help : [More Information](https://github.com/danielpalme/ReportGenerator)
==============================================================================
"C:\Program Files\dotnet\dotnet.exe" C:\Agents\CX-BUILD01-Agent02\_work\_tasks\reportgenerator_be803a55-9253-4895-a525-be570d86f161\1.0.3\tools\netcoreapp2.0\ReportGenerator.dll -reports:C:\DotCoverResults\CoverageReport.xml -targetdir:C:\ReportGeneratorResults -reporttypes:Cobertura -sourcedirs: -historydir: -plugins: -assemblyfilters:+* -classfilters:+* -filefilters:+* -verbosity:Verbose -tag:20181112.7_#(build.buildid)
Loading report 'C:\DotCoverResults\CoverageReport.xml' 1/1
Coverage report parsing took 1,0 seconds
Initializing report builders for report types: Cobertura
Analyzing 0 classes
Creating summary
Report generation took 1,1 seconds
For the sake of simplicity, I then downloaded the NuGet package and tried to locally generate a Cobertura coverage file, again with no luck. Here’s my command and output:
PS C:\Users\foo\Desktop\reportgenerator.4.0.3\tools\net47> .\ReportGenerator.exe -reports:CoverageReport.xml -reporttypes:Cobertura -targetdir:the_report
Loading report 'C:\Users\foo\Desktop\reportgenerator.4.0.3\tools\net47\CoverageReport.xml' 1/1
Coverage report parsing took 0,4 seconds
Initializing report builders for report types: Cobertura
Analyzing 0 classes
Creating summary
Report generation took 0,4 seconds
After execution, the directory the_report indeed contains a file Cobertura.xml, but it’s pretty much empty:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage line-rate="1" branch-rate="1" lines-covered="0" lines-valid="0" branches-covered="0" branches-valid="0" complexity="NaN" version="0" timestamp="1542036076">
<sources />
<packages />
</coverage>
For the sake of completeness, here’s the beginning of the dotCover coverage file I’d like to convert:
<?xml version="1.0" encoding="utf-8"?>
<Root CoveredStatements="5156" TotalStatements="321286" CoveragePercent="2" ReportType="Xml" DotCoverVersion="2018.2.3">
<Assembly Name="Archiv" CoveredStatements="0" TotalStatements="9619" CoveragePercent="0">
<Namespace Name="Archiv" CoveredStatements="0" TotalStatements="8497" CoveragePercent="0">
<Type Name="ArchivDB" CoveredStatements="0" TotalStatements="123" CoveragePercent="0">
<Constructor Name="ArchivDB()" CoveredStatements="0" TotalStatements="10" CoveragePercent="0" />
<Constructor Name="ArchivDB()" CoveredStatements="0" TotalStatements="21" CoveragePercent="0" />
<AutoProperty Name="Ablagetypen:IDBTableG<int,DateiablageTyp>" CoveredStatements="0" TotalStatements="1" CoveragePercent="0">
<PropertyGetter CoveredStatements="0" TotalStatements="1" CoveragePercent="0" />
</AutoProperty>
Am I doing anything wrong? I had seen this comment, but I’m not sure what it means, since there does not seem to be a ReportType argument (only reporttypes), plus, I do not see DetailedXML mentioned in the help output, so my guess is that this is outdated…
Issue Analytics
- State:
- Created 5 years ago
- Comments:23 (9 by maintainers)

Top Related StackOverflow Question
That worked, thanks for your help! You’re awesome and I hope you have a good day!
I think that I’m doing this already! Here’s a screenshot of an excerpt of our TFS build definition:
Details of the ReportGenerator task configuration (the history directory points to some network drive accessible by all build agents):
Finally, the Publish code coverage results task: