Sonar exclusions not getting excluded in the quality gate analysis

Need help in getting one thing addressed regarding sonar exclusions.
There is one yaml file which is having this task.

      - task: SonarCloudPrepare@1
          SonarCloud: 'sonarcloud'
          organization: ''
          scannerMode: 'MSBuild'
          projectKey: '$(PROJECT_KEY)'
          projectName: '$(PROJECT_NAME)'
          projectVersion: '$(TAG_DETAILS.tagName)'
          extraProperties: |
            # Additional properties that will be passed to the scanner, 
            # Put one key=value per line, example:

we are passing sonar exclusions like this.
value of var_sonar_exclusions is like this:

But still the sql files are not getting excluded from the sonar coverage.

Also we need to exclude some .cs files which is present in one folder in the associated repo.

Please let us know how we can achieve this by passing this regular expression in the variable which we have created for sonar exclusions.


Welcome to the community!

I suspect your variable isn’t being interpolated like you think it is. You can add sonar.scanner.dumpToFile=[path to file] (docs) to see exactly what key/value pairs analysis receives.