简体   繁体   中英

How to exclude/ignore referenced project(s) analysis from SonarQube

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.

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

https://i.gyazo.com/ad78d4db8c0bda657d67d17a​​9c6e78d9.png

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM