VB.Net code coverage not published on SonarQube Dashboard

Hi,

We are trying to analyse VB.Net code using SonarQube. The testcases run correctly and the codeCoverage.xml is also generated. But the code coverage is not reflected on the SonarQube Dashboard. It is always shown as 0%.
The generated code coverage when imported into Visual Studio, does show the code coverage.
Explicitly setting the SonarQube language property in the Prepare SonarQube Analysis Task doesn’t help.
We are using SonarQube 7.9.1,
Scanner for MSBuild 4.7.1
VBNet plugin 7.15.0
We are using Git SCM

Searched lot of options on internet but none of them could fetch success.
Any help would be greatly appreciated.

Can you describe your build process? To include test coverage, you will need to execute unit tests just after build and before the SonarScanner for MSBuild’s end step. Also what kind of unit test are you using?

Hi,

The build pipeline goes this way.

  1. Prepare Analysis on SonarQube
    • Integrated with MSBuild
    • Additional Properties:
      a. sonar.scm.exclusion.disabled=false
      b. sonar.language = vbnet
      c. sonar.verbose = true
      d. sonar.log.level = DEBUG
      e. sonar.vb.vscoveragexml.reportsPaths = **/*.coveragexml
  2. Nuget Restore
  3. Build Solution
    - Visual Studio Version = 2017
    - Platform = any cpu
    - Configuration = release
    - MSBuild Architecture = x86
  4. Test Assemblies
    - vstest.console.exe Identifies the test cases from working directory & executes the
    testcases
  5. Run Code Analysis
    - Publish the results to SonarQube Dashboard

The application target .Net Framework 2.0. Can we explicitly specify the framework during code analysis ? Also does the framework matter during code analysis ?

Hi @Tejal,

Do you use Azure pipelines? If yes, do you use the predefined tasks SonarCloudPrepare, SonarCloudAnalyze and SonarCloudPublish?

Are there any warnings of errors during the analysis or result publishing?