SonarScanner.MSBuild.exe end error with The SonarScanner for MSBuild integration failed: SonarQ

Hello,
Sonarqube version : 9.9.3.79811
SonarScanner version : sonar-scanner-6.0.0.81631-net-framework
System information :
Operating system:windows 10
Command 1: “C:\Sonar_Qube\sonar-scanner-6.0.0.81631-net-framework\SonarScanner.MSBuild.exe” begin /k:“ZylemMIS” /d:sonar.host.url=“http://localhost:9000” /d:sonar.login=“sqp_403f7297fad5c1738c4dd26f7ebe887cea1f9561”

—> Successful

Command 2: “C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MsBuild.exe” D:\sonarqube-10.2.1.78527\SourceCodeTestBy_SonarQube\ZylemMIS_Release_1.1.0_PBI\slnESpirit\slnESpirit.sln /t:Rebuild
—> Successful
Command 3:
“C:\Sonar_Qube\sonar-scanner-6.0.0.81631-net-framework\SonarScanner.MSBuild.exe” end /d:sonar.login=“sqp_403f7297fad5c1738c4dd26f7ebe887cea1f9561”

– Error

I am getting following error while executing command 3 SonarScanner.MSBuild.exe end
SonarScanner for MSBuild 6.0
Using the .NET Framework version 4.8 Using the .NET Framework version of the Scanner for MSBuild Post-processing started.
The SonarScanner for 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)
    15:10:59.722 Generation of the sonar-properties file failed. Unable to complete the analysis.
    15:10:59.728 Post-processing failed. Exit code: 1

Unable to complete SonarQube analysis.
I have seen many posts in the topic. But I could not find answer. How did you resolve the issue if you had same issue?
Thanks
Rajesh

Hi Rajesh,

Welcome to the community!

Are you sure all of the conditions are met? Specifically

If so, can you share your logs?

Share the Scanner for .NET verbose logs

  • Add /d:"sonar.verbose=true" to the…
    • SonarScanner.MSBuild.exe or dotnet sonarscanner begin command to get more detailed logs
      • For example: SonarScanner.MSBuild.exe begin /k:"MyProject" /d:"sonar.verbose=true"
    • “SonarQubePrepare” or “SonarCloudPrepare” task’s extraProperties argument if you are using Azure DevOps
      • For example:
        - task: SonarCloudPrepare@1
            inputs:
              SonarCloud: 'sonarcloud'
              organization: 'foo'
              scannerMode: 'MSBuild'
              projectKey: 'foo_sonar-scanning-someconsoleapp'
              projectName: 'sonar-scanning-someconsoleapp'
              extraProperties: |
                sonar.verbose=true
        
  • The important logs are in the END step (i.e. SonarQubeAnalyze / SonarCloudAnalyze / “Run Code Analysis”)

Share the msbuild detailed logs

MsBuild.exe /t:Rebuild /v:d

or

dotnet build -v:d

 
Ann

May be related:

1 Like