What parameters for MSBuild SonarScanner are used for branch management feature?

scanner
msbuild
sonarqube

(Jason Stanley) #1

SonarQube version 6.7.2
Developer Edition

Hello

We have the branch management plugin for SonarQube and I am trying to figure out what parameters to pass using the dotnet sonarscanner.

https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild

This scanner does not work if you have a sonar-project.properties file defined and I need to pass the options sonar.branch.name and sonar.branch.target for the branch management feature of SQ to work.

I got a scan to run using the following commands, but now I need to get this to work with the branch management feature:

dotnet sonarscanner begin /v:"{VersionNumber}" /k:"{REPOSITORY}" /n:"${REPOSITORY}" /d:“sonar.host.url=http://xxxx.com”
dotnet build
dotnet sonarscanner end


(Colin Mueller) #2

Greetings,

The analysis parameters sonar.branch.name and sonar.branch.target are documented alongside our Branch analysis documentation here: https://docs.sonarqube.org/7.4/branches/overview/

Some of our integrations with various ALM tools will automatically pass the correct parameters, but manually doing so from the command line is possible as well.

You can use those parameters in the same way you are passing sonar.host.url:

/d:sonar.branch.name=${mybranchname}

Cheers,

Colin


(Jason Stanley) #3

Thanks Colin