I have paste the wrong command, The correct command should be:
MSBuild.SonarQube.Runner.exe begin /k:"sonarqube_project_key" /n:"sonarqube_project_name" /v:"sonarqube_project_version" /d:sonar.cs.opencover.reportsPaths="%CD%\opencover.xml"
I have checked the
opencover.xml.
It seems the coverage is calculated correctly.
But the sonarqube did not get the information.
<Class>
<Summary numSequencePoints="3" visitedSequencePoints="2" numBranchPoints="3" visitedBranchPoints="2" sequenceCoverage="66.67" branchCoverage="66.67" maxCyclomaticComplexity="2" minCyclomaticComplexity="1" visitedClasses="1" numClasses="1" visitedMethods="1" numMethods="1" />
<FullName>CodeCoverage.Math</FullName>
<Methods>
<Method visited="true" cyclomaticComplexity="2" nPathComplexity="2" sequenceCoverage="66.67" branchCoverage="66.67" isConstructor="false" isStatic="false" isGetter="false" isSetter="false">
<Summary numSequencePoints="3" visitedSequencePoints="2" numBranchPoints="3" visitedBranchPoints="2" sequenceCoverage="66.67" branchCoverage="66.67" maxCyclomaticComplexity="2" minCyclomaticComplexity="2" visitedClasses="0" numClasses="0" visitedMethods="1" numMethods="1" />
<MetadataToken>100663297</MetadataToken>
<Name>System.Int32 CodeCoverage.Math::CodeCoverage.IMath.Divide(System.Int32,System.Int32)</Name>
<FileRef uid="3" />
<SequencePoints>
<SequencePoint vc="1" uspid="5" ordinal="0" offset="0" sl="7" sc="13" el="7" ec="24" bec="2" bev="1" fileid="3" />
<SequencePoint vc="1" uspid="6" ordinal="1" offset="3" sl="8" sc="17" el="8" ec="30" bec="0" bev="0" fileid="3" />
<SequencePoint vc="0" uspid="7" ordinal="2" offset="7" sl="10" sc="13" el="10" ec="22" bec="0" bev="0" fileid="3" />
</SequencePoints>
<BranchPoints>
<BranchPoint vc="1" uspid="8" ordinal="0" offset="1" sl="7" path="0" offsetend="3" fileid="3" />
<BranchPoint vc="0" uspid="9" ordinal="1" offset="1" sl="7" path="1" offsetend="7" fileid="3" />
</BranchPoints>
<MethodPoint xsi:type="SequencePoint" vc="1" uspid="5" ordinal="0" offset="0" sl="7" sc="13" el="7" ec="24" bec="2" bev="1" fileid="3" />
</Method>
<Method visited="true" cyclomaticComplexity="1" nPathComplexity="0" sequenceCoverage="0" branchCoverage="0" isConstructor="true" isStatic="false" isGetter="false" isSetter="false">
<Summary numSequencePoints="0" visitedSequencePoints="0" numBranchPoints="0" visitedBranchPoints="0" sequenceCoverage="0" branchCoverage="0" maxCyclomaticComplexity="1" minCyclomaticComplexity="1" visitedClasses="0" numClasses="0" visitedMethods="0" numMethods="0" />
<MetadataToken>100663298</MetadataToken>
<Name>System.Void CodeCoverage.Math::.ctor()</Name>
<SequencePoints />
<BranchPoints />
<MethodPoint vc="1" uspid="10" ordinal="0" offset="0" />
</Method>
</Methods>
</Class>