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?
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? )
So you would only need to run the scanner once for the solution.
Sry for the late answer. I was busy in another project and just came back to this topic.
Basically we have a single Gitlab repo with a single .NET solution, but the solution contains .NET projects of two independent teams. Therefor I’d like to have two Sonarqube projects. One for team A and one for team B. The challenge is that the solution is build by a single CI pipeline. This means the entire solution is build, but some analyze should go to the Sonarqube project of team A and some should go to the Sonarqube project of team B
I can determine both code parts with source/exclude statements, but I need to know how I can define two target projects for the same pipeline.
Your original question was about populating two different SonarQube projects from one analysis. That’s not possible. You’ll need to do two different build/analysis runs, passing your source/exclude statements and a different project key for each one.