So I disabled the single rule in my Project file’s ruleset file. That worked. But then Sonarlint downloaded a new ruleset from the Sonarqube server where the rule is set on again.
I understand that you use connected mode with a SonarQube server. In this case, the recommended way to silence the rule would be to disable it in the quality profile associated with your project on the server.
I see that SonarLint has created another ruleset file in your project. I suspect that this happened because the original ruleset was not set to be used as CodeAnalysisRuleSet in the csproj.
Try changing your csproj to reference NW.DataAccess.ruleset:
SonarLint should then modify NW.DataAccess.ruleset to reference SonarLint’s solution ruleset.
With this configuration your rulesets should work, and SonarLint should not create another ruleset file (and you could delete NW.DataAccess-1.ruleset).
I checked my proj file. The ruleset was already set. The only difference was that I had a condition in the PropertyGroup. I removed the property group. This time it seemed to work. But then I fixed the other projects and after that when I updated the rules, again a new ruleset was generated.
SLVS will never un-set the CodeAnalysisRuleset property, so this behavior is due to VS. I’ve observed a similar bug.
Just to confirm: are your rulesets now configured properly?
Btw, in the past week we did some changes in the rulesets generation. The updated documentation describes what the new behavior should be. We expect to release this version sometime next week.
Yes I realized that the unset behaviour is due to VS. In some of the occasions I erased the non-referenced ruleset files that were downloaded with suffix -1. It might be exactly the same bug.
The ruleset are currently configured properly. But I am not sure it’s going to stay this way next time we open that project and do development. We’ll see.
Thank you for the documentation link. If I run into issues again, I’ll update Sonarlint and check the documentation thoroughly.