The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects

Hi, Could you please help me with the error described below?
I get this error when running sonarscanner from GitHub Actions, however I don’t when running it locally from VSCode.

Thank you.

  • ALM used : GitHub
  • CI system used : GitHub Actions
  • Scanner command used when applicable (private details masked)

GitHub Actions extract

- name: Install sonarscanner
  run: dotnet tool install --global dotnet-sonarscanner
  
- name: Start sonarscanner
  run: dotnet sonarscanner begin /k:"REDACTED" /d:sonar.host.url=https://sonarcloud.io /d:sonar.login="${{ secrets.sonarcloud_login }}" /o:"REDACTED"

- name: Install dependencies
  working-directory: ./DiffieHellman/Tests/
  run: dotnet restore

- name: Build with sonarscanner
  working-directory: ./DiffieHellman/Tests/    
  run: dotnet build --configuration Release --no-restore ../DiffieHellman.sln

- name: Sonarscanner end 
  run: dotnet sonarscanner end /d:sonar.login="${{ secrets.sonarcloud_login }}"
  • Languages of the repository .NET
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
 Sonarscanner end0s
##[error]Process completed with exit code 1.
Run dotnet sonarscanner end /d:sonar.login="***"
  dotnet sonarscanner end /d:sonar.login="***"
  shell: /bin/bash -e {0}
SonarScanner for MSBuild 4.8
Using the .NET Core version of the Scanner for MSBuild
Post-processing started.
The SonarQube MSBuild integration failed: SonarQube 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)
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
11:37:10.722  Post-processing failed. Exit code: 1
##[error]Process completed with exit code 1.
  • Steps to reproduce

The steps to reproduce are described in the GitHub Actions extract.

Hi @cho7rose,

Whats does the dotnet build logs said ? Do you have something weird in it ? I suggest to run the dotnet sonarscanner begin with /d:sonar.verbose=true, and the dotnet build with verbose mode enabled, and you can them to me if you want.

Thanks.
Mickaël

The logs don’t seem to show anything abnormal.
I’m posting the logs from the build and the sonnarscanner end, to see if you can spot anything unusual.

Logs from Build

Run dotnet build --configuration Release --no-restore ../DiffieHellman.sln -v n
Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 03/30/2020 16:45:48.
     1>Project "/home/runner/work/Exercism/Exercism/DiffieHellman/DiffieHellman.sln" on node 1 (default targets).
     1>ValidateSolutionConfiguration:
         Building solution configuration "Release|Any CPU".
     1>Project "/home/runner/work/Exercism/Exercism/DiffieHellman/DiffieHellman.sln" (1) is building "/home/runner/work/Exercism/Exercism/DiffieHellman/MyCode/MyCode.csproj" (2) on node 1 (default targets).
     2>PrepareForBuild:
         Creating directory "bin/Release/netstandard2.0/".
         Creating directory "obj/Release/netstandard2.0/".
     1>Project "/home/runner/work/Exercism/Exercism/DiffieHellman/DiffieHellman.sln" (1) is building "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/Tests.csproj" (3) on node 2 (default targets).
     3>PrepareForBuild:
         Creating directory "bin/Release/netcoreapp2.1/".
         Creating directory "obj/Release/netcoreapp2.1/".
     2>CoreCompile:
         /usr/share/dotnet/dotnet exec "/usr/share/dotnet/sdk/3.1.200/Roslyn/bincore/csc.dll" /noconfig /unsafe- /checked- /nowarn:1701,1702,1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;RELEASE;NETSTANDARD;NETSTANDARD2_0 /highentropyva+ 
[...Nuget stuff]

[29]
         Using shared compilation with compiler from directory: /usr/share/dotnet/sdk/3.1.200/Roslyn/bincore
       _CopyFilesMarkedCopyLocal:
         Copying file from "/home/runner/work/Exercism/Exercism/DiffieHellman/MyCode/bin/Release/netstandard2.0/MyCode.dll" to "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/bin/Release/netcoreapp2.1/MyCode.dll".
         Copying file from "/home/runner/work/Exercism/Exercism/DiffieHellman/MyCode/bin/Release/netstandard2.0/MyCode.pdb" to "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/bin/Release/netcoreapp2.1/MyCode.pdb".
         Creating "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/obj/Release/netcoreapp2.1/Tests.csproj.CopyComplete" because "AlwaysCreate" was specified.
       _CopyOutOfDateSourceItemsToOutputDirectory:
         Copying file from "/home/runner/.nuget/packages/xunit.runner.visualstudio/2.4.0/build/netcoreapp1.0/xunit.runner.reporters.netcoreapp10.dll" to "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/bin/Release/netcoreapp2.1/xunit.runner.reporters.netcoreapp10.dll".
         Copying file from "/home/runner/.nuget/packages/xunit.runner.visualstudio/2.4.0/build/netcoreapp1.0/xunit.runner.visualstudio.dotnetcore.testadapter.dll" to "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/bin/Release/netcoreapp2.1/xunit.runner.visualstudio.dotnetcore.testadapter.dll".
         Copying file from "/home/runner/.nuget/packages/xunit.runner.visualstudio/2.4.0/build/netcoreapp1.0/xunit.runner.utility.netcoreapp10.dll" to "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/bin/Release/netcoreapp2.1/xunit.runner.utility.netcoreapp10.dll".
       CopyFilesToOutputDirectory:
         Copying file from "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/obj/Release/netcoreapp2.1/Tests.dll" to "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/bin/Release/netcoreapp2.1/Tests.dll".
         Tests -> /home/runner/work/Exercism/Exercism/DiffieHellman/Tests/bin/Release/netcoreapp2.1/Tests.dll
         Copying file from "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/obj/Release/netcoreapp2.1/Tests.pdb" to "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/bin/Release/netcoreapp2.1/Tests.pdb".
     3>Done Building Project "/home/runner/work/Exercism/Exercism/DiffieHellman/Tests/Tests.csproj" (default targets).
     1>Done Building Project "/home/runner/work/Exercism/Exercism/DiffieHellman/DiffieHellman.sln" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:12.15

sonnarscanner end has a little bit more info

Run dotnet sonarscanner end /d:sonar.login="***"

[4](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:4)SonarScanner for MSBuild 4.8

[5](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:5)Using the .NET Core version of the Scanner for MSBuild

[6](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:6)Post-processing started.

[7](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:7)16:11:40.939 16:11:40.934 Uninstalling target: /home/runner/.local/share/Microsoft/MSBuild/4.0/Microsoft.Common.targets/ImportBefore\SonarQube.Integration.ImportBefore.targets

[8](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:8)16:11:40.939 16:11:40.935 Uninstalling target: /home/runner/.local/share/Microsoft/MSBuild/10.0/Microsoft.Common.targets/ImportBefore\SonarQube.Integration.ImportBefore.targets

[9](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:9)16:11:40.939 16:11:40.935 Uninstalling target: /home/runner/.local/share/Microsoft/MSBuild/11.0/Microsoft.Common.targets/ImportBefore\SonarQube.Integration.ImportBefore.targets

[10](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:10)16:11:40.939 16:11:40.935 Uninstalling target: /home/runner/.local/share/Microsoft/MSBuild/12.0/Microsoft.Common.targets/ImportBefore\SonarQube.Integration.ImportBefore.targets

[11](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:11)16:11:40.939 16:11:40.935 Uninstalling target: /home/runner/.local/share/Microsoft/MSBuild/14.0/Microsoft.Common.targets/ImportBefore\SonarQube.Integration.ImportBefore.targets

[12](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:12)16:11:40.939 16:11:40.935 Uninstalling target: /home/runner/.local/share/Microsoft/MSBuild/15.0/Microsoft.Common.targets/ImportBefore\SonarQube.Integration.ImportBefore.targets

[13](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:13)16:11:40.939 16:11:40.935 Uninstalling target: /home/runner/.local/share/Microsoft/MSBuild/Current/Microsoft.Common.targets/ImportBefore\SonarQube.Integration.ImportBefore.targets

[14](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:14)16:11:40.939 16:11:40.935 Uninstalling target: /home/runner/Microsoft/MSBuild/15.0/Microsoft.Common.targets/ImportBefore\SonarQube.Integration.ImportBefore.targets

[15](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:15)16:11:40.939 16:11:40.935 Uninstalling target: /home/runner/Microsoft/MSBuild/Current/Microsoft.Common.targets/ImportBefore\SonarQube.Integration.ImportBefore.targets

[16](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:16)16:11:40.939 16:11:40.939 sonar.verbose=true was specified - setting the log verbosity to 'Debug'

[17](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:17)16:11:40.94 Loading the SonarQube analysis config from /home/runner/work/Exercism/Exercism/.sonarqube/conf/SonarQubeAnalysisConfig.xml

[18](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:18)16:11:40.94 Not running under TeamBuild

[19](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:19)16:11:40.94 Analysis base directory: /home/runner/work/Exercism/Exercism/.sonarqube

[20](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:20)Build directory:

[21](https://github.com/cho7rose/Exercism/runs/546033040?check_suite_focus=true#step:7:21)

@mickaelcaro I’ve found what it was. I wasn’t providing the working directory to sonarscanner begin and end :man_facepalming:
I managed to get it all working.

Thank you

Hi Vishnu
I am also getting same error while building the pipeline in run code analysis for sonar
cloud im getting the error. plz solve the error.

Hey @anu_azure

Instead of bumping a very old, solved topic – please raise a new thread with all the details asked for in the template post.

I’ll proceed to close this thread.