Sonarcloud on Azure Devops showing different lines of code to local CI

Hi, we’re currently migrating our sonar cloud setup away from a local CI Server up to Azure DevOps. All appears to be working well, however, on the same project, I’m getting different lines of code from the CI Server vs the Azure cloud run appearing in the different Sonar projects.

It appears to be one folder (VS project) which isn’t being counted as code for the Azure run, even though the tests are all run fine and there is coverage also shown. The exclusions etc. are all identical between the local to the cloud version.

on our CI server project on sonarcloud, *.cs files in one particular folder show with correct lines of code and 100% coverage, but on our Azure project on sonarcloud, they have - lines of code but still 100% coverage.

I’m not expecting a fix, but wondered if there were any suggestions on how to fix or how I can help diagnose?


Hi @andrew1 ,

Which scanner are you using in both CI tool ? In which version ?

Please note that, using the Scanner for MSBuild, all test projects that are considered and categorised such, are not counted at all in the Line of Codes computation.

Thank you.

Hi, thanks for the reply.
In Azure we’re using SonarScanner for MSBuild 4.7.1 (from v1.9.0)
And on the CI Server we’re using SonarScanner for MSBuild 4.6.2 which was updated a few months ago.

Hi @andrew1

I see you get coverage for the “ignored” project. Are you also getting reported issues on those files? Is it a test project or a production code project?

It would help us to see the diagnostic log files from analyses with both instances. To get the diagnostic logs please run SonarScanner.MSBuild.exe begin /k:"MyProject" /d:sonar.verbose=true as the begin step, and please attach the output of END step.

Please also share the logs of the BUILD step.

Ideally from using both instances (if possible), to compare the logs.