- SonarQube version sonarqube-9.6.1.59531 - via Azure Devops pipelines.
Trying to suppress rules in c# using MSBuild scannerMode.
I don’t have access to the UI on the SonarQube Virtual Machine so cannot suppress in UI.
Suppress in azure-pipelines.yml
I have tried adding the suppression the SonarQubePrepare
task, but this seems to have no effect.
- task: SonarQubePrepare@5
inputs:
SonarQube: 'SonarQube Service Connection'
scannerMode: 'MSBuild'
configMode: 'manual'
projectKey: ${{ parameters.projectKey }}
projectName: ${{ parameters.projectName }}
sources: ${{ parameters.sources }}
extraProperties: |
sonar.issue.ignore.multicriteria=e1,e2,e3,all
sonar.issue.ignore.multicriteria.e1.ruleKey=csharpsquid:S4457
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*
sonar.issue.ignore.multicriteria.e2.ruleKey=roslyn:CA2254
sonar.issue.ignore.multicriteria.e2.resourceKey=**/*
sonar.issue.ignore.multicriteria.e3.ruleKey=external_roslyn:CA2254
sonar.issue.ignore.multicriteria.e3.resourceKey=**/*
sonar.issue.ignore.multicriteria.all.ruleKey=*
sonar.issue.ignore.multicriteria.all.resourceKey=**/*
Using sonar-project.properties
I have tried using sonar-project.properties
but the MSBuild scanner rejects that file.
Using SonarQubeSetting Include=
I tried renaming the sonar-project.properties
and including it via the SonarQubeSetting
, but that didn’t work either.
<ItemGroup>
<SonarQubeSetting Include="CustomerPlanning.sonar-project.properties">
<Value>**/*.cs</Value>
</SonarQubeSetting>
</ItemGroup>
Can you please provide a working example of the suppressions for the SonarQubePrepare
task? All the support issues I have read say to use the UI, but that is not an option for me.