View SonarQube full analysis report in the build summary in Azure DevOps

I need to make SQ full analysis report displayed in the build summary of my pipeline in Azure Devops server. After googling, I came across a thread at How to view the SonarQube full analysis report in the build summary in Azure DevOps? - Stack Overflow

where it talks about verion 3 and the possibility of Include full analysis report in build summary in the version 3 of the task Prepare Analysis Configuration

I am using normally Version 5, is it still available somewhere this config or disappeared in new versions.

Anyway, did try to test, switched the prepare job to version 3 and provided “sonar-project.properties” in the root of the application

image

here is the contents of the file

sonar.sourceEncoding=UTF-8
sonar.projectKey=import-ps-presidents-ci
sonar.projectName=import-ps-presidents-ci
sonar.projectVersion=1.0
sonar.sources=/src
sonar.tests=/test

Whenever I run the pipeline, I get the following error

Can you please provide a set of settings for this file in order to be able to be read? Thanks

Hi, any idea please?

@eliassal are you are using the /s: property to tell the scanner where the sonar-project.properties file is?

That would explain the results you are seeing - the /s: setting is used to point the SonarScanner for .NET at an XML settings file. See the docs for more information.

1 Like

Thanks Duncan, No I am not using it.
First of all, there is no place/possibility to enter a command line switch/option for the extension configuration

2nd, I visited the doc, not sure I understand what should I give or do.
“”“”“”“”“”“”“”“”“”“”“”“”“”
/s:<custom.analysis.xml> [optional] Overrides the $install_directory/SonarQube.Analysis.xml. You need to give the absolute path to the file.

If it is optional, Is it created by default somewhere and if yes where does the file gets created?
Can you share an example please and contents of the xml file?

OK, while waiting for your confirmation, when I search my hard drive, I find several working directories in Azure devops agent the file SonarQube.Analysis.xml

and here are the contents of those file, I am not sure from where AZure pipeline gets copy of this file

Any help, idea please @duncanp ?

@eliassal, does this problem only occur when you are trying to execute v3.* of the Prepare analysis on SonarQube task?

The options I get when using v3 of the task look different from what is your screenshot above:

Having looked at the code for v3, it would indeed have passed the sonar-project.properties file to the scanner using the /s argument, which would then fail since the scanner is expecting an XML file.

However, v3 is very old. You’re normally using v5, so I would definitely not recommend going back to v3.

The “modern” equivalent of Include full analysis report in the build summary is the separate Publish Quality Gate Result task, which you should after execute after the Run Code Analysis step.

A successful build summary will look like the following:
image

Thanks Duncan, yes, this is what I get when pipeline runs successfully but as a requirement requested is that we we want to avoid some developers/users/sub-contractors from accessing sonarQube directly (for so many reasons), we need to see the resultas inside the build summary not the download link which should help those developers/users/sub-contractors to see the outcome directly

@eliassal I don’t think that’s currently possible.

You could start a thread in the Product Manager for a Day - Sonar Community describing your scenario and requirements.