SonarScanner not indexing all modules

I’m using SonarScanner for MSBuild 5.7.2 in a an Azure DevOps build agent (ubuntu-latest) for a number of .NET Core solutions that are all broadly similar. All the solutions contain 2 projects, the main project and the unit test project (named .csproj and .UnitTests.csproj).

For some of the solutions SonarScanner (during the analyse step) is indexing both projects (the main and the test) as separate modules, but for some of the solutions it’s only indexing the test project. The actual Azure DevOps pipeline is identical for all solutions, so there’s no difference there.

The question is how can I troubleshoot what modules SonarScanner indexes to try and find out why it’s not even indexing the main csproj for certain solutions?

@danb to start with I suggest you check how the scanner is classifying the projects (see this wiki page).

If the projects are being classified correctly, please you share the verbose logs for the end step.

To get this in Azure DevOps you should add the sonar.verbose to the Prepare step e.g.:

- task: SonarCloudPrepare@1
    inputs:

      extraProperties: |
        sonar.verbose=true