Can I use dotnet sonarscanner to report to multiple projects?

I need to setup Sonarqube for a C# solution which contains two “independent” projects. I can’t split up the solution because of “political reasons”. I found out that I can create two Sonarqube projects and use sonar.sources and sonar.inclusion to associate the correct C# projects to them.

How can I “fill” the two projects with data in a single build run? I’m using sonarscanner for dotnet like this:

dotnet sonarscanner begin /k:"[Project]"

but it only accepts a single project. Can I start sonarscanner twice before I run the build? Any other tricks?

Hi,

Welcome to the community!

Are these projects part of the same solution? There’s a bit of a nomenclature clash when you put SonarQube and .NET together. If both of your .NET projects are part of the same .NET solution, then that’s one SonarQube project (confused yet? :crazy_face:)

So you would only need to run the scanner once for the solution.

Does that make sense?

 
Ann