Need to exclude Data contract file from SonarQube coverage

Hi SonarQube Community,

How to include sonar qube exclusion in Data contracts having struct type in c#.
I have tried following things to achieve exclusion.

  1. Added following code in .csproj file
      <ItemGroup>
          <SonarQubeSetting Include="sonar.coverage.exclusions">
            <Value>Filename.cs</Value>
          </SonarQubeSetting>
        </ItemGroup>
  1. Added [ExcludeFromCodeCoverage] attribute over struct.
[DataContracts]
[ExcludeFromCodeCoverage]
public struct Abc: IAbc
{}

Please can anyone help me with how to achieve sonarqube exclusion in such scenarios?

Hey there.

As requested in the template post, what version of SonarQube are you using?