Coveragexml file is not being used with sonarscanner.msbuild

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

We are using the following:

  • SonarScanner for MSBuild 4.6.2
  • Using the .NET Framework version of the Scanner for MSBuild

The following are the steps we execute:

  1. sonarscanner.msbuild begin /k:“pr-test1” /d:sonar.verbose=true /d:sonar.cs.vstest.reportPaths="%CD%\TestResults*.trx" /d:sonar.cs.vscoveragexml.reportsPaths="%CD%\TestResults\results.coveragexml"
  2. build.ps1 (builds our solution using msbuild)
  3. test.ps1 (runs our tests using vstest.console.exe /EnableCodeCoverage /logger:trx)
  4. codecoverage /output:TestResults\results.coveragexml TestResults\results.coverage
  5. sonarscanner.msbuild end

The last command succeeds without errors, but the code coverage is 0% and there is no mentioning of results.coveragexml in the (verbose) output from ‘sonarscanner.msbuild end’. The .coveragexml file is over 100MB and contains useful and accurate information

Am I missing a configuration option? A processing step?

1 Like