# Slow VSBuild times

**URL:** <https://community.sonarsource.com/t/slow-vsbuild-times/33188>\
**Category:** SonarQube Cloud\
**Tags:** azuredevops-services, csharp, performance\
**Created:** [October 20, 2020, 2:39pm UTC](https://community.sonarsource.com/t/slow-vsbuild-times/33188 "2020-10-20T14:39:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrei\_Dan\_Singeorza](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/andrei_dan_singeorza/32/16134_2.png) [@Andrei\_Dan\_Singeorza](https://community.sonarsource.com/u/Andrei_Dan_Singeorza)\
**Post date:** [October 20, 2020, 2:39pm UTC](https://community.sonarsource.com/t/slow-vsbuild-times/33188/1 "2020-10-20T14:39:57Z")

</div>

We have an integration with SonarCloud & Azure Devops, and are having trouble with slow build times, for a solution of aprox 350K lines of code.

We have the 3 steps as part of our pipeline: Prepare, Run Analysis and Publish.

The analysis task runs reasonably fast, aprox 6 mins, but I’m trying to figure out why the actual building of the sln file, using VSBuild@1 task, takes \>30min, instead of aprox 8 mins with Sonar disabled.

I assume the Prepare task does some replacing/configuring of msbuild and causes the build task to do more than usual. Is this true?

And finally, I’d be of great help to know if these times are normal for this kind of overhead, or we should investigate this further and optimize/fix problems.

---

<div class="post-metadata">

**Author:** ![mickaelcaro](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mickaelcaro/32/4147_2.png) [@mickaelcaro](https://community.sonarsource.com/u/mickaelcaro)\
**Post date:** [October 26, 2020, 7:46am UTC](https://community.sonarsource.com/t/slow-vsbuild-times/33188/3 "2020-10-26T07:46:38Z")

</div>

Hi @Andrei_Dan_Singeorza and welcome to the community !

> [@Andrei\_Dan\_Singeorza](#):
>
> I assume the Prepare task does some replacing/configuring of msbuild and causes the build task to do more than usual. Is this true?

Yes this is true. We add target for the subsequent msbuild/dotnet build task(s)

> [@Andrei\_Dan\_Singeorza](#):
>
> And finally, I’d be of great help to know if these times are normal for this kind of overhead, or we should investigate this further and optimize/fix problems.

There are multiple factors here :

- Number of lines of code : build time will increase. We’re constantly adding rules to our analyzers, and some of them can take a bit of time to execute. However, this is good to be reported as we try to decrease this overhead on each release.
- Complexity of your code : as above, especially for security analysis, this can be a pretty long tasks.

That being said, you can add the verbosity to diagnostic on your build task, there will be a detail view of our analyzer performing, with time taken for each rule processed.  
You can then, if it’s relevant, desactivate the rules that take the most time. But this is a workaround for sure. Let me know if you want to troubleshoot particularly your project.

Mickaël

---

<div class="post-metadata">

**Author:** ![Andrei\_Dan\_Singeorza](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/andrei_dan_singeorza/32/16134_2.png) [@Andrei\_Dan\_Singeorza](https://community.sonarsource.com/u/Andrei_Dan_Singeorza)\
**Post date:** [October 28, 2020, 2:24pm UTC](https://community.sonarsource.com/t/slow-vsbuild-times/33188/4 "2020-10-28T14:24:28Z")

</div>

Indeed, there’s a list of warnings from sonar for each project (e.g. S3220), but I’m not sure how to infer from this which rules take up the most time.

I’ve parsed the warnings into a frequency map of warning type and occurrences, but each warning takes very little time to be outputted, and I’m assuming this is just the logging time, not the analysis time.

Isn’t it possible there’s some very expensive rule which takes a long time for each project, but for which there are no offending occurrences? Is this information outputted somewhere else?

If we could get in touch to discuss this in more detail, that would be great, but I’m not sure how to contact you (or sonar support), and I’d rather not give out my contact info on the forum here.

Thanks!

---

<div class="post-metadata">

**Author:** ![Andrei\_Epure](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/andrei_epure/32/77402_2.png) [@Andrei\_Epure](https://community.sonarsource.com/u/Andrei_Epure)\
**Post date:** [November 16, 2020, 5:37pm UTC](https://community.sonarsource.com/t/slow-vsbuild-times/33188/6 "2020-11-16T17:37:47Z")

</div>

Hi @Andrei_Dan_Singeorza - we sent you a private message where you can share your information. You can access it [here.](https://community.sonarsource.com/t/re-slow-vsbuild-times/33644)

---

<div class="post-metadata">

**Author:** ![Andrei\_Epure](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/andrei_epure/32/77402_2.png) [@Andrei\_Epure](https://community.sonarsource.com/u/Andrei_Epure)\
**Post date:** [November 27, 2020, 10:39am UTC](https://community.sonarsource.com/t/slow-vsbuild-times/33188/7 "2020-11-27T10:39:47Z")

</div>

As a public update: we’ve deployed some performance improvements with SonarCSharp 8.15 which is now on :sonarcloud:. We are committed to continue to make incremental improvements, as we believe performance is a feature.

---

<div class="post-metadata">

**Author:** ![Tom\_Howlett](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tom_howlett/32/22183_2.png) [@Tom\_Howlett](https://community.sonarsource.com/u/Tom_Howlett)\
**Post date:** [October 19, 2021, 10:50am UTC](https://community.sonarsource.com/t/slow-vsbuild-times/33188/8 "2021-10-19T10:50:12Z")

</div>

Hello

For users of SonarCloud and SonarQube 9.1+ you now have the ability to run the analysis in concurrent execution mode. This can significantly reduce your analysis time. Just set the following environment variable in the begin step:

`SONAR_DOTNET_ENABLE_CONCURRENT_EXECUTION: true`

We would love to hear if you have tried this, if you have please could you post a comment [on this post](https://community.sonarsource.com/t/net-analyzer-supports-concurrent-execution-and-more-c-9/48015/8) and tell us how you got on?

Thanks

Tom
