Scan both C# and Python files together in one project

SonarQube edition: Enterprise EditionVersion 9.9.1 (build 69595)

We have the following structure of out project:

We want to analyze this project as a whole and upload the single reports to SonarQube to a single project containing analysis for both C# and Python files from subfolder_A and subfolder_B. Basically having the same folder structure in SonarQube and its full analysis.

As we know, analysis of C# is only possible with the MSBuild version of SonarQube scanner, however in this case the Python files will be skipped. Since they are not referenced in .csproj files in folder B (and we are not going to do that).

What we have tried:

  • Performing 2 separate sets of SonarQube steps for subfolder_A (with CLI scanner) and for subfolder_B (with MSBuild) while publishing to same project (name, key and version). Result: the results of scan of folder B overrides the scan results of folder A.

Please advice on how this can be achieved. We are using Azure DevOps platform CI to publish the scans. Once again:

  • We have one project in SonarQube
  • In which we want scan results of subfolder A and B.
  • For both C# and Python.

And that’s the only workaround right now – to include the files in your .csproj. Otherwise, you will need two separate projects.