# SonarQube Analysis takes more than 20 min in .NET project

**URL:** <https://community.sonarsource.com/t/sonarqube-analysis-takes-more-than-20-min-in-net-project/71173>\
**Category:** SonarQube Server / Community Build\
**Tags:** msbuild, sonarqube, dotnet, scanner\
**Created:** [September 8, 2022, 4:30pm UTC](https://community.sonarsource.com/t/sonarqube-analysis-takes-more-than-20-min-in-net-project/71173 "2022-09-08T16:30:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danilo\_Ulbrich](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/danilo_ulbrich/32/36948_2.png) [@Danilo\_Ulbrich](https://community.sonarsource.com/u/Danilo_Ulbrich)\
**Post date:** [September 8, 2022, 4:30pm UTC](https://community.sonarsource.com/t/sonarqube-analysis-takes-more-than-20-min-in-net-project/71173/1 "2022-09-08T16:30:17Z")

</div>

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.

 ![jenk](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/c/6/c6c7e61f30d07debb29309370d05b4bb06aa098b.png)

 ![jenkins](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/d/0/d0bb54ea353cae6944775e5df0e640e9a0c77e74.png)

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

```auto
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.

```auto
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.

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [September 9, 2022, 3:08pm UTC](https://community.sonarsource.com/t/sonarqube-analysis-takes-more-than-20-min-in-net-project/71173/2 "2022-09-09T15:08:33Z")

</div>

Hi Danilo,

Welcome to the community!

Does this help:

> [@SonarScanner analysis report compress takes a long time](https://community.sonarsource.com/t/sonarscanner-analysis-report-compress-takes-a-long-time/58553/9):
>
> Hi, Heard about this issue from a friend so did some digging. Was able to replicate the issue on my mac (local analysis) and got a profile showing the majority of the slowdown was during the ZipOutputStream.putNextEntry, closeEntry and close. This got me thinking a little and looking at how the analysis works… From my understanding, sonarScanner will work in a .sonar-scanner folder in the project working folder, usually mounted to /usr/src (although the github action mounts to github/workspace…

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![Danilo\_Ulbrich](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/danilo_ulbrich/32/36948_2.png) [@Danilo\_Ulbrich](https://community.sonarsource.com/u/Danilo_Ulbrich)\
**Post date:** [September 9, 2022, 4:31pm UTC](https://community.sonarsource.com/t/sonarqube-analysis-takes-more-than-20-min-in-net-project/71173/3 "2022-09-09T16:31:21Z")

</div>

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.

```auto
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!

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [September 9, 2022, 4:46pm UTC](https://community.sonarsource.com/t/sonarqube-analysis-takes-more-than-20-min-in-net-project/71173/4 "2022-09-09T16:46:29Z")

</div>

Hi,

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

&nbsp;  
Ann
