Need sonarqube support on below intermittent Jenkins build failure at sonar scanner stage

Hi Team,
Im from Devops support ,we do dotnet build and scan for our application on jenkins build agent server.the build server has capabilities of running multiple build in parallel ,the issue is with below error ,the build is failing due to below error intermittently but it works fine when we retry . its frustrating that developer reporting same issue again and again with Devops. so we need to know the possible reason for this error. I did go through your community page already on this issue but unable to get the exact fix to be applied.
Could you please help with permanent solution on this pls?

[2023-01-13T10:51:40.024Z] D:\jenkins\workspace\ines_FIRM_EMEA_Common.UI_release>"C:\Program Files\dotnet\dotnet.exe" sonarscanner end 
[2023-01-13T10:51:40.285Z] SonarScanner for MSBuild 5.0.4
[2023-01-13T10:51:40.285Z] Using the .NET Core version of the Scanner for MSBuild
[2023-01-13T10:51:40.285Z] Post-processing started.
[2023-01-13T10:51:40.543Z] 10:51:40.36  The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
[2023-01-13T10:51:40.543Z] Possible causes:
[2023-01-13T10:51:40.543Z]   1. The project has not been built - the project must be built in between the begin and end steps
[2023-01-13T10:51:40.543Z]   2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.

[2023-01-13T10:51:40.543Z]   3. The begin, build and end steps have not all been launched from the same folder
[2023-01-13T10:51:40.543Z]   4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
[2023-01-13T10:51:40.543Z] 10:51:40.361  Generation of the sonar-properties file failed. Unable to complete the analysis.
[2023-01-13T10:51:40.544Z] 10:51:40.366  Post-processing failed. Exit code: 1
script returned exit code 1

A few questions to help you:

  • What are you trying to accomplish? To find the root cause of the issue occurring.
  • Why does this matter to you? Its failing the jenkins build.
  • How would that look in SonarQube? Alternatives? Nil
  • How would we know it works well? retry works fine.
  • Why should it be a priority now? Its often failing with that error and goes away when we retry.

Make sure to check out our product roadmap as well, to see if your need is already being considered.

Hi,

Since this is happening intermittently I need to ask whether you have multiple build agents. I would guess that you have a lower-than-acceptable version of MSBuild installed on one or more of them.

 
Ann

Hi Ann, No no we use only one windows agent for msbuild and dotnet build through our CICD pipeline.
On the same build agent only it fails and get successful intermittent ly.
Here we are using donet.exe for build and scan.

C:\Program Files\dotnet\dotnet.exe" sonarscanner end

Our build agent is running with dotnet core 6 version whereas their source code is built with dotnet core 3.1 version. Would that be creating issue here? Dotnet core 6 should be backward compatible right it should not create any issues i believe

Hi,

What about the begin command and the build? Are you building before you try to run analysis?

Per the docs:

The Sonar Scanner for .NET requires your project to be built with MSBuild 14.0.

 
Ann