Analyzing multiple C/C++ projects using build-wrapper and msbuild scanner

Hi Team,

Sonarqube 6.7
SonarCFamily 5.1.1

We are setting up our first scan using Developer Edition and the SonarCFamily Scanner. We’d like to scan a large project with ~60% shared c/c++ code which builds a number of products from multiple solution files, and have this all in one SonarQube project.

We have this working in Azure DevOps for a single solution using the build wrapper, however when we attempt to scan multiple solutions only the last scan is analysed. Can the build wrapper be used to combine analysis from multiple solutions?

For example:

  1. Prepare Analysis Configuration:
    (SonarScanner.MSBuild.exe begin)
sonar.cfamily.build-wrapper-output=bw_output
  1. Build Wrapper (msbuild):
./rootFolder/solution1/build-wrapper-win-x86-64.exe --out-dir bw_output msbuild.exe
./rootFolder/solution2/build-wrapper-win-x86-64.exe --out-dir bw_output msbuild.exe
  1. Run Code Analysis
    (SonarScanner.MSBuild.exe end)

Many thanks,
Carl

Hi @carlstyan,

yes, just do something:

./rootFolder/solution1/build-wrapper-win-x86-64.exe --out-dir bw_output call /c myscript.bat

and in myscript you put:

msbuild.exe firsolution.sln
msbuild.exe secondsolution.sln

However I am not sure that the msbuild scanner support multiple msbuild.exe calls between the begin and the end step.

If you are analyzing C/C++ projects with no C# I would recommend you to use the sonar-scanner and follow the generic analysis steps described in https://docs.sonarqube.org/latest/analysis/languages/cfamily/.

2 Likes

A post was split to a new topic: Help to setup C/C++ analysis