Error Running sonar.cfamily analysis in VSTS


(Nick Paterakis) #1

I’m trying to execute a simple scan over a Linux Debian/perl based code (without having to do a full build) -getting error:

018-07-02T08:32:48.7072732Z INFO: Using 1 thread for analysis according to value of “sonar.cfamily.threads” property.
2018-07-02T08:32:48.7274550Z ##[error]ERROR: Property “” was not specified.

which stops execution. VSTS is cloud hosted and using Sonar cloud to undertake analysis.

(Fabrice Bellingard) #2

Hi Nick,

This error means that SonarCloud found C/C++ files which require first a full build (with the C/C++ build wrapper) to make sure the correct configuration is passed through the build wrapper output file. So in other words: it’s not possible to run an analysis on C/C++ without having first built the source code.

(Ruan Kritzinger) #3

Running into the same problem and can’t find any documentation on how to get this resolved. Documentation only mentions to build it using the wrapper however nowhere does it state how to actually accomplish this using VSTS. Any assistance with this would be much appreciated.

(Fabrice Bellingard) #4

You need to download the build wrapper and extract it somehow, before it is executed. A typical script would be something like:

curl -LsS >
./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make clean all

And the you can trigger the analysis.

(Ruan Kritzinger) #5

The problem is not running this locally as that’s easy. As I mention before, how do we do it from Visual Studio team Services (VSTS)??

(Ruan Kritzinger) #6

Still not able to get this working natively in VSTS. Would be great if someone from SonarCloud could step up and provide some assistance here, I am sure there are many people that would benefit from knowing how to do this using VSTS and the Hosted build agents…

(Fabrice Bellingard) #7

Ruan: the script I shared downloads the build wrapper, so you just need to add a Bash task (or similar - like a Powershell task if you prefer) in your Azure Pipeline and execute it before you trigger the “Run Analysis” task.

I’ve created VSTS-178 to make it easier for C/C++ users to configure their jobs.

(Ruan Kritzinger) #8

Fabrice: Thanks for the feature request. I finally got it to build using the wrapper on a Hosted Windows machine in VSTS. All the tasks now succeeds however when I check sonarcloud after (the published link provided) it seems that there is no data. As in lot of the code is missing from the report. I’ve checked exclusions and only have the below, which is the same for other projects we have and works (although no wrapper needed for them). Any suggestions?


(Fabrice Bellingard) #9

Can you clarify:

  • if you are you trying to analyze a .NET solution that contains C# code
  • What exact command/tasks you are triggering to perform the analysis

(Ruan Kritzinger) #10


Yes, the code is a combination of C# and C++.
The exact command is running below as cmd:

$(build.artifactstagingdirectory)/build-wrapper-3.11/win-x86-64/build-wrapper-win-x86-64.exe --out-dir $(build.artifactstagingdirectory)/bw-output C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"

(Fabrice Bellingard) #11

I’m definitely not an expert in this C# and C++ mixed solutions, but it looks like you are missing some steps required to perform a successful analysis in this context.

Can you take a look at this “Building on Windows with MSBuild a Solution made of a mix of C++ and C#” doc page and tell if it helps?

(Ruan Kritzinger) #12

Again that is if you build natively in windows if I am not mistaken? I’m using the steps provided in your help section for VSTS:

Sure the Begin/and end tasks already does what you are proposing? I’ve attached the entire pipeline tasks.

(Fabrice Bellingard) #13

Hi Ruan,

do you think you could share logs from the build? (maybe even privately) Because without logs, this is going to be extremely difficult for me to be able to help you (running analyses on a solution which contains a mix of C#/C/C++ is probably the most complex use case we can think of).

(Ruan Kritzinger) #14

Happy to work with you in whichever way we can get this resolved, as we are likely to have more project like this soon.

(Massimo Paladin) #20

Hi @ruankr,

could you please provide the logs of two steps:

  • Build Solution Using Sonar Wrapper
  • Run Code Analysis

(Ruan Kritzinger) #21

Hi Massimo

Sure, how can I share these with you privately?

(Massimo Paladin) #22

Hi @ruankr,

sent you a PM.

(Massimo Paladin) #23

Hi @ruankr,

from the logs I can see 25 c++ files analyzed and C# reports being imported. What do you mean when you say that you don’t see a lot of code? Are you referring to what files? C++? C#? Others?