Sonar coverage exclusion not working in nested folder structure

Hi,

We want to exclude some files from coverage report. We are using the option -d:sonar.coverage.exclusions=PATHTOTHEFILE. Our solution folder structure is as below, we tried multiple possible values for the ‘PATHTOTHEFILE’ but none seems to be working.

Folder Structure

RootFolder
ABC.Sln
Folder1
Folder1SubFolderA
Folder1SubFolderASecondSubFolderA
FileZZ.cs
Proj1.csproj
Folder2
Folder3
Folder4

The combinations we tried are as below.

d:sonar.coverage.exclusions=**/RootFolder/Folder1/Folder1SubFolderA/Folder1SubFolderASecondSubFolderA/FileZZ.cs

d:sonar.coverage.exclusions=/RootFolder/Folder1/Folder1SubFolderA//*.cs

d:sonar.coverage.exclusions=**RootFolder/Folder1/Folder1SubFolderA/Folder1SubFolderASecondSubFolderA/FileZZ.cs

d:sonar.coverage.exclusions=RootFolder/Folder1/Folder1SubFolderA/Folder1SubFolderASecondSubFolderA/FileZZ.cs

d:sonar.coverage.exclusions=**/Folder1/Folder1SubFolderA/Folder1SubFolderASecondSubFolderA/FileZZ.cs

d:sonar.coverage.exclusions=Folder1/Folder1SubFolderA/Folder1SubFolderASecondSubFolderA/FileZZ.cs

d:sonar.coverage.exclusions=Folder1SubFolderA/Folder1SubFolderASecondSubFolderA/FileZZ.cs

d:sonar.coverage.exclusions= Folder1SubFolderASecondSubFolderA/FileZZ.cs

d:sonar.coverage.exclusions= FileZZ.cs

d:sonar.coverage.exclusions=**/Folder1SubFolderA/Folder1SubFolderASecondSubFolderA/FileZZ.cs

d:sonar.coverage.exclusions= **/Folder1SubFolderASecondSubFolderA/FileZZ.cs

d:sonar.coverage.exclusions= **/FileZZ.cs

Hey there.

To start with, if you’re using the SonarScanner for .NET, analysis parameters should be passed as /d:sonar.coverage.exclusions=, not -D.