I am trying to write custom rules in sonar for C#. After doing some research, got something on how to write rules and integrate with sonar. For the reference please look at the post https://stackoverflow.com/a/53889326/6499361.
So basically we have to follow three steps to do so:
- Use Roslyn to Write a Live Code Analyzer.Building this project will generate a .nupkg file
- Use the SonarQube Roslyn SDK to generate a custom SonarQube plugin that wraps the Roslyn analyzer.Running this tool will generate a jar. I am using RoslynSDK-2.0
- Use the generated jar file as a rule in Sonar, which could be integrated to sonar by using it as a plugin
I have written analyzer code which works fine.I have the .nupkg file with me which is generated after building the project.
Now I want to generate a plugin for sonar. So when I run the generator tool by following command:
RoslynSonarQubePluginGenerator /a:AnalyzerExample.1.0.6971.18074.nupkg
I get the following error:
No packages with the specified id were found: AnalyzerExample.1.0.6971.18074.nupkg
I have tried putting the .nupkg file at different locations, as mentioned in the following post: https://github.com/SonarSource/sonarqube-roslyn-sdk#configuring-nuget-feeds
I have attached images, when I run Roslyn plugin generator.
Screenshot of the error