问题
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.
回答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
回答2:
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.
回答3:
in sonar -> administration -> General Settings -> Analysis Scope set "Source File exclusions" like that: file:**/ProjectName/* * (without spaces between * *)
来源:https://stackoverflow.com/questions/32563682/how-to-exclude-ignore-referenced-projects-analysis-from-sonarqube