How do i give parameters to SonarQube.Scanner.MSBuild.exe?

只愿长相守 提交于 2019-12-23 12:25:10

问题


From searching online and looking at sonarqube docs the only thing that I can find is:

SonarQube.Scanner.MSBuild.exe /k:KeyOfProject /n:NameOfProject
msbuild.exe C:\projectpath\soultion.sln
SonarQube.Scanner.MSBuild.exe end

The problem is there's no switches that i've found to set things like:

  • analysis mode (preview, publish, increment/issues to set if sqube reports the project to server)
  • how to make sonarqube comment on issues and code in Gitlab

The ONLY thing i can think of is by passing properties in the SonarQube.Analysis.xml but the syntax isn't clear for the sonar. properties.

 <Property Name="sonar.host.url">http://urlToYourServer.com</Property> 

is a given, but everything is highly speculative. Does anyone actually know what they're doing? The documentation online just plain sucks.

Sources I've checked out :

  • https://github.com/SonarSource/sonar-scanning-examples/tree/master/sonarqube-scanner-msbuild/CSharpProject
  • https://docs.sonarqube.org/display/SONAR/Analysis+Parameters
  • https://docs.gitlab.com/ee/ci/variables/

回答1:


You have to use the /d:property=foo syntax. For example, /d:sonar.host.url=http://urlToYourServer.com or /d:"sonar.host.url=http://urlToYourServer.com"

I have updated the documentation of the Scanner for MSBuild so it will be easier for the next person.

Thanks for raising this!



来源:https://stackoverflow.com/questions/44761224/how-do-i-give-parameters-to-sonarqube-scanner-msbuild-exe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!