The main branch of this project is empty - .net Framework app


I’m trying to push analysis to my sonarqube server but the analysis aren’t showing on dashboard page and I’m seeing this message “The main branch of this project is empty” even I execute the task from master branch.

My configurations are:

  • SonarServer: sonarqube:lts-community docker image
  • Scanner: AzureDevops Task
  • Sonar version: * v9.9.5 (build 90363)

I already tryied this without success:

  • Include SonarQubeTestProject to force sonar to don’t check my project as Test
  • Change sonar.projectCreation.mainBranchName in General configuration to “master”
  • Delete and update branch name using sonar web api

And to be more strange, I can see the code, but not as main branch:


I suspect this is caused by setting the property to master. Since the default main branch name is, well, main, passing a different value will mark the analysis as being for a non-main branch.

Try omitting the parameter in your next analysis. You can then rename the branch if you like (Project Settings → Branches and Pull Requests → [row dots menu]).