Custom NOSONAR Roslyn Analyzer rule only detects in Rule Project, not in other C# projects

Hi,
I’ve developed a custom Roslyn analyzer to detect // NOSONAR comments and packaged it as a SonarQube plugin (JAR). The rule is correctly installed in SonarQube, appears in the Quality Profile, and works as expected in the test project where the rule was created.

However, when I activate the same rule for other C# projects (using the same Quality Profile and SonarQube version), // NOSONAR comments are not detected.

What additional steps are required to ensure that my custom NOSONAR rule is executed and detects comments in other C# projects?
Is it necessary to publish the analyzer as a NuGet package and reference it in each project, or is there another recommended way to deploy and activate the rule for all projects in SonarQube?

Hi,

Welcome to the community!

To be honest, I’m not sure why your plugin is working at all. We don’t actually support developing custom rules in Java for C#.

However, we pick up issues from Roslyn analyzers automatically. So instead of packaging your rule in a plugin, just run it as a Roslyn analyzer during the build, and it should “just work”.

 
HTH,
Ann

Exactly that. Adding your own Roslyn analyzers, or existing ones is a piece of cake.

Hi there, how did you create your plugin exactly? Did you use the Roslyn SonarQube SDK?

If you do not require the management or rules through a Quality Profile, just including your Roslyn Analyzer in the targeted projects, as @ganncamp and @Corniel indicated, is much easier and maintenance-free.

Denis