MSBuild target SonarQube.Integration.targets does not consider values specified in "Additional Properties" of VSTS Task "Prepare Analysis"

scanner
tfs
msbuild

(Fabian) #1

Hello,

I’m using VSTS Task version 4 and would like to ignore test projects globally by using “sonar.msbuild.testProjectPattern” via “Additional Properties” of “Prepare Analysis” build step.
Specified value is detected by build step correctly, since output shows input parameters in “SONARQUBE_SCANNER_PARAMS”.

The function “IsTestFileByName” of build target “SonarQubeCategoriseProject” uses the config file produced by “Prepare Analysis” build step to set “SonarQubeTestProject” parameter for matching test projects.
But the additional properties are missing in “SonarQubeAnalysisConfig.xml” whereby no project is marked as test project. I expected to find my additional properties in section “LocalSettings”.

From my point of view this behavior is produced by a mismatch between the build task and the preprocessing of the scanner. Preprocessing of the scanner for MSbuild considers command line parameters only.
By extending Scanner.js and passing the parameter “sonar.msbuild.testProjectPattern” as command line parameter (“scannerRunner.arg(’/d:sonar.msbuild.testProjectPattern=.*CustomTestProjectName.(cs|vb)proj$’);”) everything works as expected.

Any other parameter specified in “Additional Properties” which is used by the scanner via environment variables is working as expected.


SonarQube Version 7.2.1
SonarScanner for MSBuild 4.3.1
VSTS Task: Prepare analysis on SonarQube version 4.3.2


(Julien Henry) #3

Hi @FabianZ

Thanks for reporting the issue.

I added your use case to https://github.com/SonarSource/sonar-scanner-msbuild/issues/527

Thanks,