How to use multicriteria ignore in a .NET project with sonar scanner

SonarQube version:
Version 8.9.1 (build 44547)

SonarScanner version:

There are some rules that I want to ignore in my .NET project. I would like to do it in the .csproj file, or any other file which I can version control.

I have tried to define it in my .csproj like this:

    <SonarQubeSetting Include="sonar.issue.ignore.multicriteria">
    <SonarQubeSetting Include="sonar.issue.ignore.multicriteria.e1.ruleKey">
    <SonarQubeSetting Include="sonar.issue.ignore.multicriteria.e1.resourceKey">

Then I get the following error:
WARN: Specifying issue exclusions at module level is not supported anymore. Configure the property ‘sonar.issue.ignore.multicriteria’ and any other issue exclusions at project level.

How do I configure it at project level?


Welcome to the community!

The easiest way to manage exclusions is through the UI.


Hi Ann,

I see, but I would like to solve it in a config file, which is tied to the project, and is on github. I wouldn’t like to set it up in Sonar, so when the project moves to another instance in the future, it would have to be set up again.

So I understand that the UI is the easiest way, but your answer implies there IS another way.
And I would need help solving it this way.


TBH, I don’t know enough about .NET analysis to tell you whether there is or not. The docs might help.


Thank you for the documentation link.
Unfortunately it’s not mentioned there, but it’s such a common scenario I would think it should be possible…
Especially considering the error message states that it’s not supported anymore → it was someday…

I have also tried specifying it through command line arguments, then the error I got was this:
Specifying module-relative paths at project level in property ‘sonar.issue.ignore.multicriteria’ is deprecated.

So this feature worked in multiple ways in the past, now I can’t find a way for it to work, and documentation doesn’t mention it either.

Was it removed then completely?


It’s possible to set exclusions via analysis parameters, but it is not optimal. You’ve already figured out the parameter names. Now you just need to know where to put them. I believe the docs I sent you to cover that.


It’s possible to set exclusions via analysis parameters, but it is not optimal.

What do you mean by that? The process of setting them up is not optimal, or it has different effects than doing it through the UI?

I have figured it out though.
I have had to set them in SonarQube.Analysis.xml
Like this:

<SonarQubeAnalysisProperties  xmlns:xsi="" xmlns:xsd="" xmlns="">

  <Property Name="sonar.issue.ignore.multicriteria">e1,e2</Property>
  <Property Name="sonar.issue.ignore.multicriteria.e1.ruleKey">Web:TableWithoutCaptionCheck</Property>
  <Property Name="sonar.issue.ignore.multicriteria.e1.resourceKey">**/*.cshtml</Property>
  <Property Name="sonar.issue.ignore.multicriteria.e2.ruleKey">Web:S5256</Property>
  <Property Name="sonar.issue.ignore.multicriteria.e2.resourceKey">**/*.cshtml</Property>


I just didn’t have access to that as it’s on a remote build server, but now I have access so I could try it out.

Now I just have to set it up so that the .xml comes from our repository, and it’s done.

And yeah, it was mentioned in the docs that such file exists, just didn’t know what’s the difference between this and setting properties in the .csproj.

Thank you for the help