I have a question regarding FXCop analysis using SonarQube with the MSBuild-Runner. I have realized that the MSBuild-Runner loads a rules file from the server which matches the quality profile in Sonar and uses that file for the FXCop run.
In our project we have a solution with several projects. For each project a rules file is configured depending on its type e.g. product or test code. We also use custom rules in own FXCop assemblies.
How can I configure MSBuild-Runner so that he uses the rules file which is configured in the project file? How can I add our custom rules into Sonar? Can I import our rules files somehow?
Thanks for your help!
You must use a single quality profile to analyze all projects within your solution. Indeed, only a single quality profile is used during a SonarQube analysis. In theory, you could create two quality profiles in SonarQube, and run two SonarQube analysis (one for example on all product code, and another one on all test code), but this requires some manual setup on your side.
Regarding custom rules, they are supported: You need to create them in SonarQube web interface from the "Template for custom FxCop rules" rule template, and then enable the newly created custom rules in your quality profile.