Skip to end of metadata
Go to start of metadata

This page is covering a special case where you have a Solution made of C++ and C#. In such context, to have an accurate analysis of the C# code, you need to use the SonarQube Scanner for MSBuild.

Known Limitation

The source code stored in shared folders, not considered as "Project" by Visual Studio, won't be scanned.

Step 1: Install the SonarQube Scanner for MSBuild

Download and install the SonarQube Scanner for MSBuild  

Step 2: Prepare your build environment

Analysis of C and C++ projects requires the SonarQube Build Wrapper. It gathers all the configuration required for correct analysis of C/C++ projects (defined macros, include directories, …) directly from your project's build process. The Build Wrapper does not impact your build; it merely eavesdrops on it. 

 You can download the Build Wrapper directly from your SonarQube Server, so that its version perfectly matches your version of the plugin:

Step 3: Build and analyze your project using the Build Wrapper

MSBuild projects are analyzed in three steps (see example below):

  1. Execute the SonarQube Scanner for MSBuild "begin" step
  2. Add execution of Build Wrapper to your normal MSBuild build command
  3. Execute the SonarQube Scanner for MSBuild "end" step to complete the analysis

More information on configuring Visual C++ analysis in VSTS or TFS is available here.


SonarScanner.MSBuild.exe begin /k:"cs-and-cpp-project-key" /n:"My C# and C++ project" /v:"1.0" /"bw_output"
build-wrapper-win-x86-64.exe --out-dir bw_output MSBuild.exe /t:Rebuild
SonarScanner.MSBuild.exe end
  • No labels