Scenario: I am migrating our current VS Solution analysis setup from using the sonar-runner to using the MSBuild runner. However I am encountering a fairly significant problem.
In the old setup, we specified our project name, key and most importantly a long list of skipped projects (sonar.visualstudio.skippedProjectPattern
) using the sonar-project.properties
file.
This is because [WARNING: ugly legacy bad coding practice alert] we have six solutions that build dozens and dozens of projects, all out of the same git repo. A lot of the projects are common across several solutions and we don't want them analyzed more than once. So each solution has a set of projects that it "owns" and which are analyzed as part of it. Thus the sonar-project.properies
file for each of the other solutions specifies that these projects are to be ignored.
The Problem: In the new MSBuild Runner approach, there does not appear to be MS solution level (also read as SonarQube Project level) configuration file or mechanism aside from passing arguments on the command line to the MSBuild runner's 'begin' phase. One either has the global configuration file, or the MSBuild *.*proj
files, (that is, MS project level configuration files). This latter is clearly out of the question as whether a project gets excluded from analysis is based on which solution is being analyzed.
As noted, conceivably we could pass all this in on the command line but that is sub optimal. Our builds are done by scripts that are, to the extent possible, generic. Having the configuration in the sonar-project.properities
file was a big help in keeping them that way and we are hoping we are missing something here that will let us keep using that file or a similar one. Are we?
There currently is no equivalent to the sonar-project.properties
file in the MSBuild SonarQube Runner version 1.0. I've added a new ticket to the project's backlog to consider adding this feature in an upcoming release: http://jira.sonarsource.com/browse/SONARMSBRU-124
The v1.0 MSBuild SonarQube Runner supports a /s:
command line argument that allows you to specify the global settings file to use. The settings file can contain any additional global settings that previous you would have put in the sonar-project.properties
file.
If you don't specify a global setting file the MSBuild Runner will look for a default global settings file in the same location as the runner executable.
See the documentation repo for more information: https://github.com/SonarSource/sonar-.net-documentation/blob/master/doc/appendix-2.md
来源:https://stackoverflow.com/questions/31817430/migrating-from-sonar-runner-to-msbuild-runner-where-did-the-sonar-project-prope