My build in VSTS pipeline is failing due to sonar-project.properties file. It says sonar-project.properties files are not understood by the SonarScanner for MSBuild. Remove those files from the following folders: D:\a\1\s<project folder>.
I tried excluding this file in prepare by providing sonar.exclusion=# sonar.exclusions=/*.bin,/*.properties in Advanced configuration but there is not option available to set for Run code analysis task. So I have added **/sonar-project.properties inside Sonar dashboard : Administration/Configuration/Analysis Phase/Source file exclusion. But still I’m getting same error.
We already have repository created which has sonar-project.properties. I tried excluding it on sonar dashboard (Administration->Configuration->Analysis Scope) by putting **/sonar-project.properties or **/*.properties but it is still failing giving same error.
Also I’m getting below error:
##[error]The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper
##[error]and setting the property “sonar.cfamily.build-wrapper-output”, but it was not specified.
##[error]If you don’t want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties:
sonar-project.properties file already in the source code is not compatible with the Scanner for MSBuild. The reason is that the scanner generates itself a file, with all sources reference, to be able to be analyzed by the underlying base scanner.
What i suggest is to either gitignore this file (so it won’t be checked out and then not taken by the Scanner), or delete it, and configure everything you want in the “additional properties” field on the Prepare analysis Configuration task on Azure DevOps.
I’m using VSTS. Do I need to add .gitignore file in my project file. Is it fine to avoid adding it. Can’t I ignore everything specifying in my VSTS tasks.
The problem is, for this particular file, if we just exclude it, then we won’t be able to overwrite it (or at least we could face some permissions issue), that’s the reason why we fail fast in the Scanner if any file with that name was found on the file system.
I have removed this file. Now issue I’m getting is below(screenshot1). I tried ignoring it using .gitignore by mentioning /.sonarqube//* but still I don’t able to see result(zero results for bugs, code smells) on dashboard(screenshot2)