0

My company has been developing a static analysis tool using the Roslyn API since it was in beta. Currently we use Microsoft.CodeAnalysis and Microsoft.CodeAnalysis.Workspaces.MSBuild version 3.6.0, our tool opens projects with MSBuildWorkspace, and walks the syntax trees to gather syntactical and semantical information.

My current task is to run the analyzer packages on the projects and gather their results too, this is where I am stuck. I was able to get compiler warnings and even hidden messages using SemanticModel.GetDiagnostics() and Compilation.GetDiagnostics(), but if the project has FxCopAnalyzers or SonarAnalyzer.CSharp enabled, I could not find their results anywhere. I assume because we do not run a full build, these analyzers do not get run either.

Is there a solution to run analyzers and get their results via code with our setup? It would be a bonus, if we could enable extra analyzers, the project does not include by itself.

Tejes
  • 144
  • 1
  • 10

0 Answers0