SonarQube template for .Net projects

csharp
sonarqube

(Dharmendra Kumar) #1

I am using SonarQube for Java rules. I created custom rules using sonarqube UI -> Rules -> Java -> Template -> Shows Templates Only

I am able to create rules using this for java.

I want same for .Net/C# projects also. How to get that.


(Valeri Hristov) #2

Template rules are not supported for C# and VB.NET. To create a custom rule you will need to create a Roslyn analyzer, for example by following the links in this article:
https://docs.microsoft.com/en-us/visualstudio/extensibility/getting-started-with-roslyn-analyzers?view=vs-2017

Then if you use the latest versions of SonarC# and Scanner for MSBuild you would be able to automatically import the issues from your rule to SonarQube.