The main branch of this project is empty - DevOps

Hello there,

I am using DevOps,
The repository is .NET / C# code

After I run my DevOps pipeline in SonarCloud I get the following message:
The main branch of this project is empty.
The repo in SonarCloud has foundings but 0 line of code

I have other repositories with the same pipeline and the same code structure and it works for those,
but for sone projects i get “The main branch of this project is empty.”
It is kind of weird behavious,
Does anybody have an idea on how to solve this?

Below are the pipeline commands,

- task: SonarCloudPrepare@1
    displayName: 'Prepare analysis on SonarCloud'
    inputs:
      SonarCloud: 'SonarCloudServiceConnection'
      organization: 'org-name'
      scannerMode: 'MSBuild'
      projectKey: $(projectName)
      projectName: $(projectName)

- task: DotNetCoreCLI@2
    displayName: Dotnet Build
    inputs:
      projects: '**/*.sln'
      arguments: '--configuration $(buildConfiguration)'

 - task: DotNetCoreCLI@2
    displayName: 'Dotnet Test'
    inputs:
      command: 'test'
      projects: '**/*Tests/*.csproj'
      arguments: '--configuration $(buildConfiguration) --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura'
      nobuild: true
	  
- task: PublishCodeCoverageResults@1
    displayName: 'Publish code coverage report'
    inputs:
      codeCoverageTool: 'Cobertura'
      summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'

- task: SonarCloudAnalyze@1
    displayName: 'Run Code Analysis'

- task: SonarCloudPublish@1
    displayName: 'Publish Quality Gate Result'
    inputs:
      pollingTimeoutSec: '300' 

Hey there.

It looks like you’re running dotnet test, but no dotnet build, which you’ll need in order to analyze C# code.

Thanks for your reply, I actually forgot to paste that part, but in between SonarCloudPrepare and dotnet test, i do the following:


  - task: DotNetCoreCLI@2
    displayName: Dotnet Build
    inputs:
      projects: '**/*.sln'
      arguments: '--configuration $(buildConfiguration)'