The projects analyzed with the .NET Core version of SonarScanner for MSBuild includes test projects

  • versions used SonarQube - 7.9 LTS, sONARsCANNER - 4.10.0
  • error observed -
    The projects analyzed with the .NET Core version of SonarScanner for MSBuild includes test projects.
    Whereas This is contrary to the .NET Framework version of SonarScanner for MSBuild, which automatically excludes test projects based on the project name

We shouldn’t be analyzing test code with SonarQube.

Is that just the behavior of the .NET Core version of the scanner? Or are we missing something?

1 Like

Just to be clear, are you analysing the same projects but getting different results depending on the “flavour” of the scanner you are using?

The .NET Core and .NET Framework versions of the SonarScanner for .NET (formerly SonarScanner for MSBuild) use the same logic to determine whether a project is a test project or not so the results should be the same. This page explains the detail and describes how to investigate how your projects are being classified.

Two different projects.
The first project is analyzed with the .NET Framework version of SonarScanner for MSBuild, which automatically excludes test projects.
The second Project is analyzed with the .NET Core version of SonarScanner for MSBuild, but this one includes test projects.

Ok. Do the projects you expect to be classified as test projects contain any of the markers that the scanner uses to recognise test projects? (see the page I linked to above).