Dotnet scanner doesn't consider sonar.exclusions properties set in SonarQube

Must-share information (formatted with Markdown):

  • dotnet-sonarscanner - v8.0.2
  • SonarQube v10.6.0.92116
  • I’m running analysis on my .Net project with excluded files.
  • Since version 8.0.2, the “sonar.exclusions” set inside SonarQube project settings are ignored and all files are scan. I saw that a temporary patch has been applied in this new version but apparently it has some side effects

Hey there.

What are you seeing in the logs that make you think all files, including files you don’t expect, are being scanned? Was a different version behaving differently? More details would really help!

Ah – turns out we have a regression! [SCAN4NET-48] - Jira

We’ll come back with a fix ASAP.

Hey Colin,
I noticed that because the code covered and files analysed are wider: New errors appeared in the reports and code coverage has reduced since the new version.

Here are the logs:
With version 8.0.1

INFO: 175 files ignored because of inclusion/exclusion patterns
INFO: 184 files ignored because of scm ignore settings
INFO: Loading plugins for detected languages
INFO: Load/download plugins
INFO: Load/download plugins (done) | time=5020ms
INFO: Executing phase 2 project builders
INFO: Executing phase 2 project builders (done) | time=108ms
INFO: Load project repositories
INFO: Load project repositories (done) | time=863ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: **/Offline/*Offline*.cs, **/Migrations/*

With version 8.0.2

INFO: Branch name: main
INFO: Preprocessing files...
INFO: 4 languages detected in 713 preprocessed files
INFO: 1 file ignored because of inclusion/exclusion patterns
INFO: 163 files ignored because of scm ignore settings
INFO: Loading plugins for detected languages
INFO: Load/download plugins
INFO: Load/download plugins (done) | time=2367ms
INFO: Executing phase 2 project builders
INFO: Executing phase 2 project builders (done) | time=132ms
INFO: Load project repositories
INFO: Load project repositories (done) | time=765ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: coverage.xml

In SonarQube, sonar.exclusions is set with :
**/Offline/*Offline*.cs, **/Migrations/*