Version: Sonarqube Version 6.7 (build 33306)
Goal: Display coverage percentage for .net solution using C# and vb.net
Hi,
Im very new in Sonar and Teamcity, Im trying to configure the coverage percentage. My project has a mix of languages C# and vb.net but in Sonar page result I only see C# classes.
At the moment my steps are:
- Clean Solution
- Nuget Restore
- Build Solution (Rebuild)
- Run test using VSTests and dotcover
- Generation of html file (using powershell)
Write-Host “Generating Coverage…”
$snapshot = Get-ChildItem “%system.teamcity.build.tempDir%” -Filter coverage_dotcover*.data | select -ExpandProperty FullName -First 1
%teamcity.dotCover.home%\dotCover.exe report /ReportType=HTML /Source="$snapshot" /Output=“TestResults/CoverageReport.html”
%teamcity.dotCover.home%\dotCover.exe report /ReportType=XML /Source="$snapshot" /Output=“TestResults/CoverageReport.xml”
- SonarQube Runner
Additional Parameters:
-X
-Dsonar.language=cs
-Dsonar.sourceEncoding=UTF-8
-Dsonar.cs.dotcover.reportsPaths=TestResults/CoverageReport.html
-Dsonar.cs.vstest.reportsPaths=%teamcity.build.checkoutDir%\TestResults*.trx
Note: if I remove “-Dsonar.language=cs” I get an error saying:
"
[Step 6/7] 15:33:09.628 ERROR: Error during SonarQube Scanner execution
[15:33:09] [Step 6/7] 15:33:09.628 INFO: Final Memory: 76M/702M
[15:33:09] [Step 6/7] 15:33:09.628 INFO: ------------------------------------------------------------------------
[15:33:09] [Step 6/7] org.sonar.java.AnalysisException: Please provide compiled classes of your project with sonar.java.binaries property
[15:33:09] [Step 6/7] at org.sonar.java.JavaClasspath.init(JavaClasspath.java:66)
"
Many thanks for your help!