Unset sonar.branch.name


In TFS On premise, using git, we’ve a PR build that looks at the incoming changes and queues the warranted builds (UI/Backend/Both/None).
The triggered build gets the sonar.branch.name field populated, and no analysis info is attached to the PR.
During the Analysis Preparation we tried setting

sonar.pullrequest.base=(baseBranchRef) sonar.pullrequest.key=(PullRequestId)

with those values being passed in as parameters.

The code analysis run fails with this error:

##[error]Caused by: A pull request analysis cannot have the branch analysis parameter ‘sonar.branch.name’

Is there a way to unset or not set the sonar.branch.name ?


Welcome to the community!

Can you make sure you’re on the latest version of the integration pieces in TFS? If you’re not adding that parameter, then it’s probably being “helpfully” inserted for you - my guess is by an old version of the TFS/ADO integration.


Can you confirm a newer version would not do it? tbh, setting the branch name feels like the right behavior when you queue the build from a branch.
But it would be good to be able to unset it, if you queue the build programatically.


Well since I’m only guessing at where it’s coming from in the first place… no. :smile:

a) it’s worth a shot
b) it’s generally best to be on the latest version of utilities unless you have a concrete reason not to be.