SonarScanner with MSBuild and properties file

I want to plug my build pipeline to my SonarQube server (Version 7.9.1.27448). For that, I’m using SonarScanner for AzureDevOps on a TFS server 2018 with the “Integrate with MSBuild” option.

My project is composed by an ASP.Net application (cs, cshtml), JavaScript/TypeScript files, CSS, HTML and XML.
I want add properties for exclude somes files from scanning. I doing it by a propertie file store in a subdirectory. I can’t move easily this file to the Build root folder.
So, I add a parameter in “additional Properties” like this :

project.settings=MyProject\sonarQube.analysis.properties

But Sonar analyse my excluded files. Do I use it correctly ? Is there a way to use property file with Integrate With Ms Build Option ?

Hi @Cedric and welcome to the community !

Exclusions and all settings can be passed directly in the additional properties. The Scanner for MSBuild generates it’s own sonar-project.properties so it will not take the file you provide in account.

HTH,
Mickaël

Hi @mickaelcaro, thank you for your answer.
Ok, so it’s simply impossible to merge my two files. I’m following the wrong path.
If I want have shared parameters in all my Builds definitions (GatedCheckin, Integration Build, etc.), I can do it only with TFS global variables. Is there another solution to do that ?