0
votes

I have installed the sonarqube scanner plugin in jenkins and added the below properties in execute sonarqube scanner in the build section of jenkins instance.

# Project identification
sonar.projectKey=BUS.App
sonar.projectVersion=Test
sonar.projectName=BUS App

# Info required for Sonar 
sonar.sources=.
sonar.language=cs 

#Core C# Settings
sonar.dotnet.visualstudio.solution.file=BUS.Platform2.sln
sonar.dotnet.excludeGeneratedCode=true

#----- Default source code encoding
sonar.sourceEncoding=UTF-8

After the build completion of the instance in sonar server it shows the correct analysis time but doesn't shows the analytics results.

I did the analysis in my project using SonarMSBuild (not in jenkins locally in the project folder), it shows the results correctly.

This is how the sonar server after jekins build. sonar results

Does my sonar scanner properties are wrong? or did I missed something?

This is how my build section looks in jenkins configure. enter image description here

1

1 Answers

2
votes

That's not how you analyze C#. As described in the docs You need

  • SonarQube Scanner for MSBuild - Begin Analysis
  • Build
  • SonarQube Scanner for MSBuild - End Analysis

You'll pass a couple properties in to the Begin Analysis step, but by and large you don't need those properties.

And you particularly don't need sonar.language which was deprecated years ago.