Sonar Scanner (version 4.7) scans a C library project which generated a C++ analysis report instead

Hi,
I am a newbie to SonarQube. On Jenkins I use MSBuild to build a C library project with a VS2019 project file *.vcxproj. After running sonar scanner it generates a C++ analysis observed on SonarQube instead of a C analysis. I expect a C analysis. I set
sonar.language=c inside the “sonar_project.properties” file. It does not work. It looks like the “sonar.language” is deprecated. I don’t know how to resolve this issue. Please help. Thanks in advance.

/*******************************************************************/
INFO: Sensor CFamily [cpp]
INFO: CFamily plugin version: 6.30.0.42324
INFO: Using build-wrapper output: C:\data\jenkins_home\workspace\libtpp-ctest\bw-outputs\build-wrapper-dump.json
INFO: Available processors: 12
INFO: Using 6 threads for analysis according to value of “sonar.cfamily.threads” property.
INFO: Cache is explicitly disabled: Optional[false]
ctest/packet_parser/packet_parser.c

INFO: [pool-3-thread-2] C:/data/jenkins_home/workspace/libtpp-ctest/source/zupt_dtct/zerospeed.c
INFO: PCH: unique=0 use=0 (forceInclude=0,throughHeader=0,firstInclude=0) out of 48 (forceInclude=0,throughHeader=0)
INFO: SE: 48 out of 48
INFO: Z3 refutation rate: 1 out of 8
INFO: Subprocess(es) done in 23260ms
INFO: 48 compilation units analyzed
INFO: Sensor CFamily [cpp] (done) | time=27118ms
/*******************************************************************/

Hey there.

In the context of MSBuild and C/C++ analysis, SonarQube will treat the code as C++ is /TP is passed to the compiler. See the documentation on this option here.

This should be addressed when compiling your code, rather than trying to change direction during the analysis – unless I’m messing something regarding yoru context.

Thanks for the information.