SonarCloud is taking more time

When we try to build dot net application with sonar cloud it is taking more than 1 hour. Below are the details.

  • ALM used - Azure DevOps
  • CI system used - Azure DevOps
  • Scanner command used when applicable (private details masked)
  • Languages of the repository - C#
  • Error observed - Without sonar cloud the build is taking less time(8 Min) and with sonar cloud build is taking more than 1 hour.

Hey @AshokReddy,

Welcome to the community!

Can you share what is the approximate size of your code base (for e.g it is a big one, with a couple of million lines of code)?


Hi Marcin, We have around 7500 files.

hi @AshokReddy

Did you go through our Troubleshooting .NET performance problems guide?

If yes and you haven’t found a way to optimize the build yourself, please give us the following version information:

  • please give us the verbose output of the scanner commands (please run SonarScanner.MSBuild.exe begin /k:“MyProject” /d:sonar.verbose=true as the begin step, and please attach the output of the BEGIN and END steps)
  • please give the output of running MSBuild in verbose mode (/v:d)

We enabled sonar.verbose=true in the configuration(Azure pipeline). We are not able to see verbose output. May I know where we can find?

Below is the our .Net project structure for your reference.

There are 17 + projects in solution and there are 3-4 project which are kind of common project referred in most of the other projects. Sonar cloud is scanning these common projects multiple times, hence this process is taking more time than required.

Without sonar cloud configuration, it’s taking 10 Minutes. But, with Sonar it’s taking more than 1 hour.

To get the build verbose output, you need to:

Like the Troubleshooting guide says, please run with reportanalyzer:

  • MsBuild.exe /t:Rebuild /p:reportanalyzer=true /v:d
    to the DotNetCoreCLI command. You can read the documentation from Microsoft on how to pass additional parameters to the build command.

I see that you run the build multiple times - please read in the Troubleshooting .NET performance problems guide:

Make sure you do not run the analysis twice

And I see you have multiple DotNetCoreCLI commands - why do you have this?

Thanks for your response.

For your question ‘I see you have multiple DotNetCoreCLI commands - why do you have this?’ - Since we have micro service architecture for each project we are using separate DotNetCoreCLI command.

Can you run the builds in parallel to speed up, or are there dependencies between the builds?

We generated MSBuild logs in local system. Can you please share your email id to send logs to you.

MSBuild_Verbose_Logs.txt (762.6 KB)
Please find the attached MSBuild verbose logs.

It seems that the logs are trimmed.

You can access the private message I’ve sent you on this link

I was regenerated MSBuild logs again and attached logs in the private message. Can you please check confirm if you received latest log file. I have used below command to generate MSBuild logs.

MsBuild.exe /t:Rebuild /p:reportanalyzer=true /v:d

Hi @AshokReddy. FYI Andrei has received the logs but hasn’t had a chance to look at them yet. He’ll get back to you when he has done so.

Thanks for the Update Duncan.