C# Plugin: How to specify a list of folders to exclude for the MSBuild Scanner

2,920 views
Skip to first unread message

drobny...@gmail.com

unread,
May 10, 2017, 8:27:37 AM5/10/17
to SonarQube
I'm using TFS on-premise with Build vNext and the SonarQube Task (Begin/End) and wan't to exclude certain folders from analysis.
We tried sonar.exclusions defined in the Analysis Scope but it looks like this is not working for the MSBuild Scanner. 
We also tried to specify a settings file on the task and even we modified the shipped SonarQubeAnalysis.xml to check if the exlusions are working.

This is what we see in our build log:

Excluded sources:
   some path\MockData\**
Analyzer working directory contains 5 .pb file(s)
108 files indexed
0 files ignored because of inclusion/exclusion patterns

Even with the specified exlcude pattern the files in the MockData folders are still indexed and analyzed.

Is there a documentation on how to specifc folder exclusions for the MSBuild Scanner?

Version Info:
SonarQube Task V2.1.0
SonarQube Scanner for MSBuild V2.3.1

Thanks,
Georg

Julien HENRY

unread,
May 12, 2017, 5:57:08 AM5/12/17
to SonarQube, drobny...@gmail.com
Hi,

Your pattern is probably wrong. The pattern should be relative to the project basedir. Also you should try using forward slashes. So for example if you have this layout:

mySolution/
  MySolution.sln
  Project1/
    MockData/

You have to use something like /d:sonar.exclusions=**/MockData/**
and not /d:sonar.exclusions=**/Project1/MockData/**

++

Julien
Reply all
Reply to author
Forward
0 new messages