SonarQube Analysis takes more than 20 min in .NET project

Hi Team, how are you? I have several problems with the sonar scanner in my project.

It’s a big project, we use .NET 4.5.2. Within the solution, we have 20 projects that work together.

When a developer makes a change, they request a PR and this in turn runs a Jenkins pipeline.

We had to deactivate this pipeline because it takes more than 20min, even 30. This is not accepted.

This is the code we have in Jenkins for the scan to be performed. We use MSBuild and Sonar Community EditionVersion 9.2.1.

Adding /d:sonar.verbose=true. We could see that this took approximately 5 minutes

16:56:25  14:55:13.160 DEBUG: Deploying bundle
16:56:25  14:55:13.160 DEBUG: Deploying eslint-bridge into C:\Jenkins\continuous-integration\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle
17:01:31  15:00:42.544 DEBUG: Deploying bundle (done) | time=329384ms

Any help to improve this time?

And another thing that we see that takes too long is the generation and compression of the report.

17:04:24  15:03:52.961 INFO: Analysis report generated in 16565ms, dir size=22.9 MB
17:08:15  15:08:02.337 INFO: Analysis report compressed in 249375ms, zip size=7.5 MB 

I think it’s a long time for 20MB.

Any help will be appreciated. If the pipeline takes less than 7 min, it will be correct.

Thanks for your time.

Danilo Ulbrich.

Hi Danilo,

Welcome to the community!

Does this help:

 
Ann

Hi Ann, yes this helps me a lot, the problem that I run the project with MSBuild and it is not possible to apply the sonar.working.directory property.

Is there a similar solution to apply the property sonar.working.directory = /tmp with MSBuild?

This is my code.

bat 'SonarScanner.MSBuild.exe begin' +
                                            " /k:\"${env.gitlabSourceRepoName}\"" +
                                            " /n:\"${env.gitlabSourceRepoName}\"" +
                                            " /d:sonar.verbose=true " +
                                            " /v:\"0.0.${env.BUILD_NUMBER}-${env.gitlabSourceBranch}\""

bat 'MSBuild Hub.sln /t:Rebuild /p:reportanalyzer=true'
bat 'SonarScanner.MSBuild.exe end'

Regards!

Hi,

Does it not work to add it with a /d: prefix, just like you did to turn on verbose logging?

 
Ann