Sonarqube build is not successful, could any one help on this

We are currently running a Developer Edition.
Version 9.4.0.54424

We configured developer edition through github actions.

When I am running the workflow my build is failing:

Can you share the GitHub Actions YAML file?

I am using the below yaml file and build is successful however I see the below error.

Can you help me what could be the issue and how can I resolve this.

name: Sonar-Analysis

on:
  push:
    branches:
      - dev # or the name of your main branch
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  build:
    name: Build
    runs-on: windows-latest

    steps:
      - name: Set up JDK 11
        uses: actions/setup-java@v1
        with:
          java-version: 1.11
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
      - name: Cache SonarQube packages
        uses: actions/cache@v1
        with:
          path: ~\sonar\cache
          key: ${{ runner.os }}-sonar
          restore-keys: ${{ runner.os }}-sonar
      - name: Cache SonarQube scanner
        id: cache-sonar-scanner
        uses: actions/cache@v1
        with:
          path: .\.sonar\scanner
          key: ${{ runner.os }}-sonar-scanner
          restore-keys: ${{ runner.os }}-sonar-scanner
      - name: Add xxxxxxxxNuGetPackages as nuget package source
        run: dotnet nuget add source --username xxxxxxxx --password ${{ secrets.NUGET_GITHUB_PACKAGE_TOKEN }} --store-password-in-clear-text --name xxxxxxxxNuGetPackages "https://nuget.pkg.github.com/xxxxxxxx/index.json"    
      - name: Install SonarQube scanner
        if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
        shell: powershell
        run: |
          New-Item -Path .\.sonar\scanner -ItemType Directory
          dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
      - name: Build and analyze
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
        shell: powershell
        run: |
          .\.sonar\scanner\dotnet-sonarscanner begin /k:"xxxxxxxx_xxxxxxxx.xxxxxxxxApi" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_URL }}" /d:sonar.verbose=true /d:sonar.dotnet.excludeTestProjects=false
          dotnet build
          .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

I used the same code given in documentation.

https://docs.sonarqube.org/latest/analysis/github-integration/

https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/

how should be my sonar-project.propertied file should like , can you please advise.

build is failing , can any one help on this.

Sorry, it’s not clear to me from your post what error you’re seeing.

this is the error I am seeing when I build my sonarqube with my github actions workflow.

Can you help me to resolve my issue.

The error message seems pretty clear – you can’t have a sonar-project.properties file in a folder being analyzed by the Scanner for .NET, so you should remove it from your repository.

I have removed sonar-project.properties and work flow is successful however when I look at the Sonar UI for my project I see that code is not analysed, I have been experiencing the same issue for more than a week now and could not find any solution. please help me on resolving this.

I am using the below yaml file for your reference.

name: Sonar-Analysis
on:
  push:
    branches:
      - dev  # or the name of your main branch
  pull_request:
    types: [opened, synchronize, reopened]
jobs:
  build:
    name: Build
    runs-on: windows-latest
    steps:
      - name: Set up JDK 11
        uses: actions/setup-java@v1
        with:
          java-version: 1.11
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
      - name: Cache SonarQube packages
        uses: actions/cache@v1
        with:
          path: ~\sonar\cache
          key: ${{ runner.os }}-sonar
          restore-keys: ${{ runner.os }}-sonar
      - name: Cache SonarQube scanner
        id: cache-sonar-scanner
        uses: actions/cache@v1
        with:
          path: .\.sonar\scanner
          key: ${{ runner.os }}-sonar-scanner
          restore-keys: ${{ runner.os }}-sonar-scanner
      - name: Install SonarQube scanner
        if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
        shell: powershell
        run: |
          New-Item -Path .\.sonar\scanner -ItemType Directory
          dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
      - name: Build and analyze
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
        shell: powershell
        run: |
          .\.sonar\scanner\dotnet-sonarscanner begin /k:"example" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}"
          dotnet build
          .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"