问题
Using SonarQube 5.2 (MSBuild.SonarQube.Runner.exe)... Given a Visual Studio solution containing 10 C# projects, is it possible to exclude half of those projects from SonarQube analysis without having to edit the *.csproj files directly? (I'm working with a shared code-base and don't want to pollute the project files with SonarQube specific configuration).
I've tried and failed to leverage the Analysis Scope 'Source File Inclusions' and 'Source File Exclusions' settings because the source file paths appear to be relative to the project directory and do not include the base path.
e.g. if my 'Base dir' is 'C:\Source\Projects\Project1' the source paths are detected as Source1.cs, Source2.cs, SubFolder/Source3.cs, etc. and this prevents an inclusion or exclusion rule of **\Project1***.cs from working.
Does anyone know of a way to accomplish what I need without the klunky rigmarole described here and here? Is there a way to change what 'MSBuild.SonarQube.Runner.exe' considers the base path for instance?
回答1:
Indeed, sonar.exclusions does not work in this case. I logged a bug to track this:
https://jira.sonarsource.com/projects/SONARMSBRU/issues/SONARMSBRU-191
来源:https://stackoverflow.com/questions/34010376/excluding-projects-from-the-msbuild-runner-without-changing-csproj-files