0

Can you import a Roslyn Analyzer from a NuGet package and manually call/ use them in your own code for analysing an external solution (for example letting it analyze a public git repo that you download/ clone). So it would not analyse my open Visual Studio solution, but my solution would manually call/ use it. Basically I'm trying to make a very simple alternative to SonarQube by using the output from one or multiple Roslyn analyzers and putting the information in a simple UI.

I've read that SonarQube can accept Roslyn Analyzers as plugins (https://github.com/SonarSource/sonarqube-roslyn-sdk), so I think it should be possible but I'm kinda lost where exactly to start (I've read the official documentation). Any help to point me in the right direction is appreciated.

  • 1
    Seems related: https://stackoverflow.com/questions/35322126/calling-roslyn-analyzers-from-command-line – Good Night Nerd Pride Apr 19 '23 at 10:04
  • there is a unit test framework that tests your analyzer, so it should somehow be callable manually. maybe if you find the source code of this unit test library, you can find your answer there. This might be a good entry point: https://github.com/dotnet/roslyn-sdk/blob/35d5e46fd5c403194692c645d912a17d36ed74f5/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest%601.cs#L32 – Ardor May 11 '23 at 07:21

0 Answers0