What are the parameters that are executed between UI and sonar-project.properties?

Work with:

Azure Devops pipelines
SonarScanner for MSBuild 5.2.1
INFO: SonarScanner
INFO: Project root configuration file: D:\a\1.sonarqube\out\sonar-project.properties

I don’t understand why my sonar-project.properties file is not taken into account during the sonar analysis.
I set the exclusion of Scripts file from Angular libraries like these

My sonar-project.properties

sonar.sources= .
sonar.projectKey= myOrganisation_WebApp
sonar.projectName= my-webapp
sonar.exclusions= **/Scripts/**/*



But the scan analyzes them anyway.
Why ?


however when i set the exclusion in the graphical interface the exclusion works fine.

I have the impression that the parameters defined in UI take precedence over the sonar-project.properties file.

Is this really a normal behavior?
It would seem interesting to me that the sonar-project.properties file overloads UI, to allow to keep track of the evolution of this file in source control manager, don’t you think so?

Hi @Jeremie ,

Yes, you have a good point about tracking file changes within a file. sonar-project.properties file does not work with projects scanned with Sonar Scanner for MSBuild. If you want to set those parameters, then either do it within the pipeline.yaml or within your .csproj file, both of which can be version controlled. Here’s an example with adding those sonar analysis parameters to a .csproj file:

However, most users with Azure DevOps pipelines version control these Sonar analysis parameters within their pipeline yaml in the PrepareSonarAnalysis task.


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.