Sonarcloud GitHub Action for .NET Core repo - not detecting code

I configured a Github Action to run SonarCloud against a .NET Core repo, action yaml is below, pretty much as per the example in the documentation here https://github.com/marketplace/actions/sonarcloud-scan.

jobs:

  sonarCloudTrigger:
    name: SonarCloud Trigger
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: SonarCloud Scan
      uses: sonarsource/sonarcloud-github-action@master
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
  • ALM used: GitHub
  • CI system used: GitHub Actions
  • Languages of the repository: C# (.NET Core)
  • Error observed:

The error below happens when the action runs against my PR:

Then when I log into sonarcloud for that Project, it says:

The main branch has no lines of code.

The documentation suggests it’s not supported for .NET projects, but I saw an old post about this which suggested that it works.

Can anyone shed any light on this?
Thank you :slight_smile:

Hi,

The GitHub Action uses the SonarScanner CLI under the hood, which is not analyzing C# / . NET classes.

You have to use the SonarScanner for MSBuild for that.

HTH,
Mickaël

Thank you Mickaël that is helpful!