Source File Exclusions not working

I have not had issues getting file exclusions working for code coverage and duplications, but I have recently added a number of libraries to my project locally that I need to exclude from analysis. The fun part is it takes 15 minutes per test to run the pipeline.

I have defined my exclusion rules according to the documentation. All I am trying to do is exclude all files under 2 specific paths. There are a lot of subdirectories and files in each subdirectory under these paths. I have tried a lot of variations of this but I feel like the below should work.
I have also tried:


I can see in the logs before it starts analysis that it loads the exclusion updates, I made properly. It just seems to ignore them. I am sure I am doings something dumb but please help. The online forums have not assisted. I have even put the explicit path to a file and I can see that file getting analyzed so I am at a loss getting this to work. Any assistance is greatly appreciated.

  • ALM used (Azure DevOps)
  • CI system used (Azure DevOps)
  • Scanner command used:

task: SonarCloudAnalyze@1
*Languages of the repository (c# Primarily, css, js)

  • Error observed
Error message: This analysis will make your organization '********' to reach the maximum allowed lines limit (having 221705 lines)

Hey there.

Nothing looks wrong with your exclusions, although I’d stick with this one for your testing:


My first suggestion would be to turn on DEBUG logging (sonar.verbose=true) so that you can see how the exclusions are being applied. It will also list every file that is included

My second suggestion would be going very wide with your exclusion (**/*.js) to see if it is having any impact at all. On that note – can you also confirm where you are putting the exclusions (in your pipeline, in a .csproj…?)

Apologies I didn’t get back on this one. I ended up using a nuget package with all the content references and deleted the local files.