When using the SonarAnalyzer.CSharp NuGet package (i.e. not the Sonar VS extension or SonarQube) it’s not clear how rules can be configured. I figured out that you can do it with a SonarLint.xml file (see this SO answer) but among all the Sonar* projects I couldn’t find any official information on this.
We don’t have such a guide yet. However you can see how we do it in our own repository for SonarLint Connected mode (and you can reuse the same concept for the nuget package):
Thanks Andrei, I actually did exactly that. As mentioned, I figured out how to configure the NuGet package, however, some documentation in the repo of sonar-dotnet would have been really helpful (like adding your message to the root Readme).
So, this is a feature request for sonar-dotnet. I didn’t add it to an issue there because opening a thread here is what the instructions say there.