[Rider] Adding SonarC# NuGet packages slows down local builds

Hi @Armin1979, and welcome to the community.

FYI I’ve split your post into a separate thread because it’s a different topic.

I don’t use Rider so I can’t give a definitive answer, but here are some suggestions as to a possible cause and for some troubleshooting steps.

My guess is that the performance of solution wide analysis seems to be ok is because the analysis is happening in the background so the impact is not obvious. However, the additional time is obvious during builds.

Suggestion (1): try disabling running the analyzers during build

The newer versions of MSBuild v16 now give the option to disable running code analyzers during the build. This is documented here as a Visual Studio feature, but it’s actually implemented at the MSBuild level. I’m not sure in which version of MSBuild this was introduced but I can say it’s not in v15.9 but it is in v16.4.

Suggestion (2): see if the delay is due to a specific SonarC# rule and if so disable it

This post explains how to work out how long each rule is taking to execute.

3 Likes