SonarQube Intergation with Azure DevOps

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

SonarQube version: 9.6
SonarQube Scanner version: 5.8
Version: Developer

I have configured SonarQube on a Windows VM and my code is in Azure DevOps. I am trying to run Azure Pipeline but getting the following error.

My YAML is:

trigger:

  • develop # or the name of your main branch

steps:

Prepare Analysis Configuration task

  • task: SonarQubePrepare@5
    inputs:
    SonarQube: ‘SonarQube-AzureDevOps’
    scannerMode: ‘MSBuild’
    projectKey: ‘Project keyahksds’
    projectName: ‘Project’

Run Code Analysis task

  • task: SonarQubeAnalyze@5

Publish Quality Gate Result task

  • task: SonarQubePublish@5
    inputs:
    pollingTimeoutSec: ‘300’

ERROR:

  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)
    01:25:48.805 The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
    Possible causes:
  5. The project has not been built - the project must be built in between the begin and end steps
  6. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
  7. The begin, build and end steps have not all been launched from the same folder
  8. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
    01:25:48.805 Generation of the sonar-properties file failed. Unable to complete the analysis.
    ##[error]01:25:48.811 Post-processing failed. Exit code: 1
    01:25:48.811 Post-processing failed. Exit code: 1
    ##[error]The process ‘/usr/bin/dotnet’ failed with exit code 1
    Finishing: SonarQubeAnalyze

Thank you in advance for your help.

Hey there.

I think the error message is pretty clear.

You must build your project between the Prepare and Analyze steps.