2

I have a solution which has three projects (X,Y,Z). Z referenced in Y , Y in X . When I start Analysis with MSBuild SonarQube Runner on project X, it is analyzing Y and Z as well. Do we have any solution for ignoring recursive analysis ?

Note: I can not breakup solution file into multiple solution files & refer dll's rather than projects.

StuartLC
  • 104,537
  • 17
  • 209
  • 285
Raja Moparthi
  • 101
  • 1
  • 2
  • 10

3 Answers3

2

in sonar -> administration -> General Settings -> Analysis Scope set "Source File exclusions" like that: file:**/ProjectName/* * (without spaces between * *)

https://i.gyazo.com/ad78d4db8c0bda657d67d17a9c6e78d9.png

lokusking
  • 7,396
  • 13
  • 38
  • 57
alex
  • 694
  • 2
  • 10
  • 17
1

You can statically mark individual projects as being included/excluded by setting a property in the MSBuild file. See the online docs here.

If you want to do something more dynamic have a look at the advanced config appendix.

duncanp
  • 1,572
  • 1
  • 10
  • 8
1

you can add the tag into ProjectReference 'Y' of your project 'X' configuration.

<PropertyGroup Condition=" $(ProjectGuid) != '' AND $(SonarQubeExclude) == '' ">
    <SonarQubeExclude Condition="$(ProjectGuid) == 'C999E666-3666-9990-B666-9999E666' " >true</SonarQubeExclude>
</PropertyGroup>

This must be added on X project and the id C999E666-3666... is the id that you want excluded.

More information on: https://github.com/SonarSource/sonar-.net-documentation/blob/master/doc/appendix-2.md

Guillodacosta
  • 383
  • 3
  • 8