Sonar Scanner end failed

I trying to integrate my Solution based on .net6 with SonarCloud and Github actions.The problem is that the action build failed on the sonar scanner end.I tried to change working dirs but with the same effect.The project is public HERE

The SonarScanner for MSBuild integration failed: SonarCloud was unable to collect the required information about your projects.
Possible causes:

  1. The project has not been built - the project must be built in between the begin and end steps
  2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
  3. The begin, build and end steps have not all been launched from the same folder
  4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln) SonarScanner for MSBuild 5.7.2 Using
    the .NET Core version of the Scanner for MSBuild Post-processing
    started. 10:38:06.016 Generation of the sonar-properties file failed.
    Unable to complete the analysis. 10:38:06.024 Post-processing failed.
    Exit code: 1 Error: Process completed with exit code 1.
    name: build-all

# Controls when the action will run. 
      - main

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
  # This workflow contains a single job called "build"
    # The type of runner that the job will run on
    runs-on: windows-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
          # Disabling shallow clone is recommended for improving relevancy of reporting
          fetch-depth: 0
      - uses: actions/setup-dotnet@v1
          dotnet-version: ${{ env.DOTNET_VERSION }}
      - uses: microsoft/setup-msbuild@v1
      - uses: actions/setup-java@v2
          distribution: 'adopt'
          java-version: '11'

      - name: Restore NuGet packages
        run: |
          cd App
          nuget restore App.sln
      - name: Begin Sonar scan
        run: |
          cd App
          dotnet tool install --global dotnet-sonarscanner
          dotnet sonarscanner begin /o:vladimirpetukhov /k:vladimirpetukhov_Musement_CLI /d:sonar.login=${{ secrets.SONAR_TOKEN }} /
      - name: Build Api 
        run: |
          cd ./App/App.API
          dotnet build App.API.csproj --no-restore
          #  dotnet test App.API.csproj --no-build --no-restore --verbosity normal -p:CollectCoverage=true -p:CoverletOutputFormat=opencover
      - name: Build Main 
        run: |
          cd ./App/App.Main
          dotnet build App.Main.csproj --no-restore
          #  dotnet test App.Main.csproj --no-build --no-restore --verbosity normal -p:CollectCoverage=true -p:CoverletOutputFormat=opencover

      - name: End Sonar scan
        run: |
          cd App
          dotnet sonarscanner end /d:sonar.login=${{ secrets.SONAR_TOKEN }}


I’m seeing a build command in your pipeline, rather than a rebuild or clean & build. You need to do a full build with each analysis.


@vladimir_petukhov you also need to run the begin, build and end steps from the same working folder. See S4NET-#1318 for more information.

1 Like

I can’t understand?

Currently, you are changing the current directory between each step:

Instead, don’t change the current directory, and use relative paths to specify the paths to the projects to build e.g.

1 Like