How to scan for C++ projects

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Hello,

I am using sonarqube enterprise trial edition 7.9.1 for scanning code quality of c++ project. when i run scanner i get the below error

C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wind
ows\bin>sonar-scanner.bat
INFO: Scanner configuration file: C:\New folder\sonar-scanner-cli-3.2.0.1227-win
dows\sonar-scanner-3.2.0.1227-windows\bin…\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 3.2.0.1227
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Windows Server 2012 R2 6.3 amd64
INFO: User cache: C:\Users\tiwarashext.sonar\cache
INFO: SonarQube server 7.9.1
INFO: Default locale: “en_GB”, source code encoding: “windows-1252” (analysis is
platform dependent)
WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x
INFO: Load global settings
INFO: Load global settings (done) | time=187ms
INFO: Server id: BF41A1F2-AW2mk15UKbV3KNqrFZb5
INFO: User cache: C:\Users\tiwarashext.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=78ms
INFO: Load/download plugins (done) | time=374ms
INFO: Loaded core extensions: developer-scanner
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=16ms
INFO: Project key: F22
INFO: Base dir: C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner
-3.2.0.1227-windows\bin
INFO: Working dir: C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scan
ner-3.2.0.1227-windows\bin.scannerwork
INFO: Load project settings for component key: ‘F22’
INFO: Load project settings for component key: ‘F22’ (done) | time=78ms
INFO: Load project branches
INFO: Load project branches (done) | time=47ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=31ms
INFO: Load branch configuration
INFO: Load branch configuration (done) | time=0ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=515ms
INFO: Load active rules
INFO: Load active rules (done) | time=14840ms
WARN: SCM provider autodetection failed. Please use “sonar.scm.provider” to defi
ne SCM of your project, or disable the SCM Sensor in the project settings.
INFO: Indexing files…
INFO: Project configuration:
INFO: 27 files indexed
INFO: Quality profile for cpp: Sonar way
INFO: Quality profile for xml: Sonar way
INFO: ------------- Run sensors on module Sample_Cpp_Scanreport
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=31ms
INFO: Sensor JavaXmlSensor [java]
INFO: 1 source files to be analyzed
INFO: Load project repositories
INFO: Load project repositories (done) | time=32ms
INFO: Sensor JavaXmlSensor [java] (done) | time=328ms
INFO: 1/1 source files have been analyzed
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=16ms
INFO: Sensor XML Sensor [xml]
INFO: 1 source files to be analyzed
INFO: Sensor XML Sensor [xml] (done) | time=265ms
INFO: 1/1 source files have been analyzed
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=16ms
INFO: Sensor CFamily [cpp]
ERROR:

The only way to get an accurate analysis of C/C++/Objective-C files is by using
the SonarSource build-wrapper
and setting the property “sonar.cfamily.build-wrapper-output”, but it was not sp
ecified.

If you don’t want to analyze C/C++/Objective-C files, then prevent them from bei
ng analyzed by setting the following properties:

sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 25.472s
INFO: Final Memory: 38M/377M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR:

The only way to get an accurate analysis of C/C++/Objective-C files is by using
the SonarSource build-wrapper
and setting the property “sonar.cfamily.build-wrapper-output”, but it was not sp
ecified.

If you don’t want to analyze C/C++/Objective-C files, then prevent them from bei
ng analyzed by setting the following properties:

sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging
.

C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wind
ows\bin>

Then i downloaded the build wrapper as well for Windows server 2012 as per below link

https://docs.sonarqube.org/latest/analysis/languages/cfamily/

Then i am getting the error as below

C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wind
ows\bin>build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory M
SBuild.exe /t:Rebuild
[SONARSOURCE BUILD-WRAPPER] failed to execute MSBuild.exe /t:Rebuild: The system
cannot find the file specified.

C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wind
ows\bin>

How should i scan the C++ project please team can you help?

Hi @ashwinn.tiwari,

are you usually using MSBuild.exe /t:Rebuild to build your project?

Are you running it from a dev prompt? It seems that msbuild.exe is not in the path of the prompt from which you are running.

Hello,

I have build the project now but when i scan the project successfully i dont see vulnerablities and bugs please see the below log.

Microsoft Windows [Version 6.3.9600]
© 2013 Microsoft Corporation. All rights reserved.

C:\Users\tiwarashext>cd C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar
-scanner-3.2.0.1227-windows\bin

C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wind
ows\bin>sonar-scanner.bat
INFO: Scanner configuration file: C:\New folder\sonar-scanner-cli-3.2.0.1227-win
dows\sonar-scanner-3.2.0.1227-windows\bin…\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 3.2.0.1227
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Windows Server 2012 R2 6.3 amd64
INFO: User cache: C:\Users\tiwarashext.sonar\cache
INFO: SonarQube server 7.9.1
INFO: Default locale: “en_GB”, source code encoding: “windows-1252” (analysis is
platform dependent)
WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x
INFO: Load global settings
INFO: Load global settings (done) | time=125ms
INFO: Server id: BF41A1F2-AW2mk15UKbV3KNqrFZb5
INFO: User cache: C:\Users\tiwarashext.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=79ms
INFO: Load/download plugins (done) | time=391ms
INFO: Loaded core extensions: developer-scanner
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=16ms
INFO: Project key: F22
INFO: Base dir: C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner
-3.2.0.1227-windows\bin
INFO: Working dir: C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scan
ner-3.2.0.1227-windows\bin.scannerwork
INFO: Load project settings for component key: ‘F22’
INFO: Load project settings for component key: ‘F22’ (done) | time=31ms
INFO: Load project branches
INFO: Load project branches (done) | time=16ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=16ms
INFO: Load branch configuration
INFO: Load branch configuration (done) | time=0ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=313ms
INFO: Load active rules
INFO: Load active rules (done) | time=8532ms
WARN: SCM provider autodetection failed. Please use “sonar.scm.provider” to defi
ne SCM of your project, or disable the SCM Sensor in the project settings.
INFO: Indexing files…
INFO: Project configuration:
INFO: 8 files indexed
INFO: Quality profile for cpp: Sonar way
INFO: ------------- Run sensors on module Sample_Cpp_Scanreport
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=32ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=0ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=16ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=15ms
INFO: Sensor CFamily [cpp]
INFO: Using build-wrapper output: C:\New folder\sonar-scanner-cli-3.2.0.1227-win
dows\sonar-scanner-3.2.0.1227-windows\bin\build_wrapper_output_directory\build-w
rapper-dump.json
INFO: Available processors: 8
INFO: Using 1 thread for analysis according to value of “sonar.cfamily.threads”
property.
INFO: Load project repositories
INFO: Load project repositories (done) | time=47ms
INFO: 0 compilation units analyzed
INFO: Sensor CFamily [cpp] (done) | time=1735ms
INFO: Sensor JavaSecuritySensor [security]
INFO: Reading type hierarchy from: C:\New folder\sonar-scanner-cli-3.2.0.1227-wi
ndows\sonar-scanner-3.2.0.1227-windows\bin.scannerwork\ucfg2\java
INFO: Read 0 type definitions
INFO: Reading UCFGs from: C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\son
ar-scanner-3.2.0.1227-windows\bin.scannerwork\ucfg2\java
INFO: No UCFGs have been included for analysis.
INFO: Sensor JavaSecuritySensor [security] (done) | time=0ms
INFO: Sensor CSharpSecuritySensor [security]
INFO: Reading type hierarchy from: C:\New folder\sonar-scanner-cli-3.2.0.1227-wi
ndows\sonar-scanner-3.2.0.1227-windows\bin\ucfg_cs2
INFO: Read 0 type definitions
INFO: Reading UCFGs from: C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\son
ar-scanner-3.2.0.1227-windows\bin\ucfg_cs2
INFO: No UCFGs have been included for analysis.
INFO: Sensor CSharpSecuritySensor [security] (done) | time=15ms
INFO: Sensor PhpSecuritySensor [security]
INFO: Reading type hierarchy from: C:\New folder\sonar-scanner-cli-3.2.0.1227-wi
ndows\sonar-scanner-3.2.0.1227-windows\bin.scannerwork\ucfg2\php
INFO: Read 0 type definitions
INFO: Reading UCFGs from: C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\son
ar-scanner-3.2.0.1227-windows\bin.scannerwork\ucfg2\php
INFO: No UCFGs have been included for analysis.
INFO: Sensor PhpSecuritySensor [security] (done) | time=0ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=0ms
INFO: No SCM system was detected. You can use the ‘sonar.scm.provider’ property
to explicitly specify it.
INFO: Calculating CPD for 1 file
INFO: CPD calculation finished
INFO: Analysis report generated in 140ms, dir size=138 KB
INFO: Analysis report compressed in 31ms, zip size=20 KB
INFO: Analysis report uploaded in 63ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=F22

INFO: Note that you will be able to access the updated dashboard once the server
has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=A
W20ny1m–Psf2pEkzfr
INFO: Analysis total time: 17.110 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 19.704s
INFO: Final Memory: 38M/383M
INFO: ------------------------------------------------------------------------

C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wind
ows\bin>sonar-scanner.bat

What could be reason its not showing any issues?

Hi @ashwinn.tiwari,

could you please update to SonarCFamily version 6.4?

Hi,

Can you please share the plugin name and how can i update SonarCFamily version can you please share some steps? Also do i need to add any property in Sonar.properties files ?

Please can you help?

Regards,
Ashwin

Hi,

I have updated sonarcfamily version from 6.3 to 6.4 but now i am unable to build please find the logs below

INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=16ms
INFO: Sensor C# [csharp]
INFO: Sensor C# [csharp] (done) | time=0ms
INFO: Sensor CFamily [cpp]
INFO: Using build-wrapper output: C:\New folder\sonar-scanner-cli-3.2.0.1227-win
dows\sonar-scanner-3.2.0.1227-windows\bin\build_wrapper_output_directory\build-w
rapper-dump.json
INFO: Available processors: 8
INFO: Using 1 thread for analysis according to value of “sonar.cfamily.threads”
property.
INFO: Load project repositories
INFO: Load project repositories (done) | time=15ms
INFO: 0 compilation units analyzed
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 19.909s
INFO: Final Memory: 37M/379M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: The “build-wrapper-dump.json” file was found empty. Please make sure that
:

  • you are using the latest version of the build-wrapper and the SonarCFamily a
    nalyzer
  • your compiler is supported
  • you are wrapping your build correctly
  • you are wrapping a full/clean build
    ERROR:
    ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging
    .

C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wind
ows\bin>build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory M
SBuild.exe /t:Clean;Rebuild
Microsoft ® Build Engine version 12.0.21005.1
[Microsoft .NET Framework, version 4.0.30319.36543]
Copyright © Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build,
please add the “/m” switch.
Build started 10.10.2019 13:00:44.
Project “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0
.1227-windows\bin\Example.sln” on node 1 (Clean;Rebuild target(s)).
ValidateSolutionConfiguration:
Building solution configuration “Debug|Any CPU”.
Project “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0
.1227-windows\bin\Example.sln” (1) is building "C:\New folder\sonar-scanner-cli
-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-windows\bin\Example\Example.csproj
" (2) on node 1 (Clean target(s)).
CoreClean:
Deleting file “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scann
er-3.2.0.1227-windows\bin\Example\bin\Debug\Example.dll”.
Deleting file “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scann
er-3.2.0.1227-windows\bin\Example\bin\Debug\Example.pdb”.
Deleting file “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scann
er-3.2.0.1227-windows\bin\Example\obj\Debug\Example.csprojResolveAssemblyRefe
rence.cache”.
Deleting file “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scann
er-3.2.0.1227-windows\bin\Example\obj\Debug\Example.dll”.
Deleting file “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scann
er-3.2.0.1227-windows\bin\Example\obj\Debug\Example.pdb”.
Done Building Project “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar
-scanner-3.2.0.1227-windows\bin\Example\Example.csproj” (Clean target(s)).

Project “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0
.1227-windows\bin\Example.sln” (1) is building “C:\New folder\sonar-scanner-cli
-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-windows\bin\Example.Tests\Example.
Tests.csproj” (3) on node 1 (Clean target(s)).
CoreClean:
Deleting file “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scann
er-3.2.0.1227-windows\bin\Example.Tests\obj\Debug\Example.Tests.csprojResolve
AssemblyReference.cache”.
Done Building Project “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar
-scanner-3.2.0.1227-windows\bin\Example.Tests\Example.Tests.csproj” (Clean targ
et(s)).

Project “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0
.1227-windows\bin\Example.sln” (1) is building “C:\New folder\sonar-scanner-cli
-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-windows\bin\Example.Tests\Example.
Tests.csproj” (3:2) on node 1 (Rebuild target(s)).
Project “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0
.1227-windows\bin\Example.Tests\Example.Tests.csproj” (3:2) is building “C:\New
folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-windows\b
in\Example\Example.csproj” (2:3) on node 1 (default targets).
GenerateTargetFrameworkMonikerAttribute:
Skipping target “GenerateTargetFrameworkMonikerAttribute” because all output fi
les are up-to-date with respect to the input files.
CoreCompile:
C:\Program Files (x86)\MSBuild\12.0\bin\Csc.exe /noconfig /nowarn:1701,1702 /
nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /re
ference:“C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NET
Framework\v4.5\Microsoft.CSharp.dll” /reference:“C:\Program Files (x86)\Refer
ence Assemblies\Microsoft\Framework.NETFramework\v4.5\mscorlib.dll” /referen
ce:“C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFrame
work\v4.5\System.Core.dll” /reference:“C:\Program Files (x86)\Reference Assem
blies\Microsoft\Framework.NETFramework\v4.5\System.Data.DataSetExtensions.dl
l” /reference:“C:\Program Files (x86)\Reference Assemblies\Microsoft\Framewor
k.NETFramework\v4.5\System.Data.dll” /reference:“C:\Program Files (x86)\Refe
rence Assemblies\Microsoft\Framework.NETFramework\v4.5\System.dll” /referenc
e:“C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramew
ork\v4.5\System.Xml.dll” /reference:“C:\Program Files (x86)\Reference Assembl
ies\Microsoft\Framework.NETFramework\v4.5\System.Xml.Linq.dll” /debug+ /debu
g:full /filealign:512 /optimize- /out:obj\Debug\Example.dll /subsystemversion
:6.00 /target:library /utf8output IAnimal.cs Animals\Cat.cs Animals\Dog.cs Pr
operties\AssemblyInfo.cs “C:\Users\tiwarashext\AppData\Local\Temp\491.NETFra
mework,Version=v4.5.AssemblyAttributes.cs”
CopyFilesToOutputDirectory:
Copying file from “obj\Debug\Example.dll” to “bin\Debug\Example.dll”.
Example -> C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3
.2.0.1227-windows\bin\Example\bin\Debug\Example.dll
Copying file from “obj\Debug\Example.pdb” to “bin\Debug\Example.pdb”.
Done Building Project “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar
-scanner-3.2.0.1227-windows\bin\Example\Example.csproj” (default targets).

ResolveAssemblyReferences:
Primary reference “nunit.framework, Version=3.0.5813.39031, Culture=neutral,
PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL”.
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets
(1635,5): warning MSB3245: Could not resolve this reference. Could not locate t
he assembly “nunit.framework, Version=3.0.5813.39031, Culture=neutral, PublicKe
yToken=2638cd05610744eb, processorArchitecture=MSIL”. Check to make sure the as
sembly exists on disk. If this reference is required by your code, you may get
compilation errors. [C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-s
canner-3.2.0.1227-windows\bin\Example.Tests\Example.Tests.csproj]
For SearchPath “{HintPathFromItem}”.
Considered “…\packages\NUnit.3.0.1\lib\net45\nunit.framework.dll”, b
ut it didn’t exist.
For SearchPath “{TargetFrameworkDirectory}”.
Considered “C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
mework.NETFramework\v4.5\nunit.framework.winmd”, but it didn’t exist.
Considered “C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
mework.NETFramework\v4.5\nunit.framework.dll”, but it didn’t exist.
Considered “C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
mework.NETFramework\v4.5\nunit.framework.exe”, but it didn’t exist.
Considered “C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
mework.NETFramework\v4.5\Facades\nunit.framework.winmd”, but it didn’t exist
.
Considered “C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
mework.NETFramework\v4.5\Facades\nunit.framework.dll”, but it didn’t exist.
Considered “C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
mework.NETFramework\v4.5\Facades\nunit.framework.exe”, but it didn’t exist.
For SearchPath “{Registry:Software\Microsoft.NETFramework,v4.5,Assem
blyFoldersEx}”.
Considered AssemblyFoldersEx locations.
For SearchPath “{AssemblyFolders}”.
Considered “C:\Program Files\IIS\Microsoft Web Deploy V3\nunit.framew
ork.winmd”, but it didn’t exist.
Considered “C:\Program Files\IIS\Microsoft Web Deploy V3\nunit.framew
ork.dll”, but it didn’t exist.
Considered “C:\Program Files\IIS\Microsoft Web Deploy V3\nunit.framew
ork.exe”, but it didn’t exist.
Considered “C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
mework\v3.0\nunit.framework.winmd”, but it didn’t exist.
Considered “C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
mework\v3.0\nunit.framework.dll”, but it didn’t exist.
Considered “C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
mework\v3.0\nunit.framework.exe”, but it didn’t exist.
For SearchPath “{GAC}”.
Considered “nunit.framework, Version=3.0.5813.39031, Culture=neutral,
PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL”, which was not
found in the GAC.
For SearchPath “{RawFileName}”.
Considered treating “nunit.framework, Version=3.0.5813.39031, Culture
=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL” as a f
ile name, but it didn’t exist.
For SearchPath “bin\Debug”.
Considered “bin\Debug\nunit.framework.winmd”, but it didn’t exist.
Considered “bin\Debug\nunit.framework.dll”, but it didn’t exist.
Considered “bin\Debug\nunit.framework.exe”, but it didn’t exist.
AssemblyFoldersEx location: “{Registry:Software\Microsoft.NETFramework,v4.5,
AssemblyFoldersEx}”
C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\

      C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9\bin\plugins\Diagn

ostics
C:\Program Files\Microsoft SDKs\Azure.NET SDK\v2.9\ref\Caching
C:\Program Files\Microsoft SDKs\Azure.NET SDK\v2.9\ref
C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAss
emblies
C:\Program Files (x86)\Microsoft Chart Controls\Assemblies
C:\Program Files\Microsoft SDKs\Azure.NET SDK\v2.9\ref
GenerateTargetFrameworkMonikerAttribute:
Skipping target “GenerateTargetFrameworkMonikerAttribute” because all output fi
les are up-to-date with respect to the input files.
CoreCompile:
C:\Program Files (x86)\MSBuild\12.0\bin\Csc.exe /noconfig /nowarn:1701,1702 /
nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /re
ference:“C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2
.0.1227-windows\bin\Example\bin\Debug\Example.dll” /reference:“C:\Program Fil
es (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Microsof
t.CSharp.dll” /reference:“C:\Program Files (x86)\Reference Assemblies\Microso
ft\Framework.NETFramework\v4.5\mscorlib.dll” /reference:“C:\Program Files (x
86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Core.d
ll” /reference:“C:\Program Files (x86)\Reference Assemblies\Microsoft\Framewo
rk.NETFramework\v4.5\System.Data.DataSetExtensions.dll” /reference:“C:\Progr
am Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Sy
stem.Data.dll” /reference:“C:\Program Files (x86)\Reference Assemblies\Micros
oft\Framework.NETFramework\v4.5\System.dll” /reference:"C:\Program Files (x8
6)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Xml.dll
" /reference:“C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework
.NETFramework\v4.5\System.Xml.Linq.dll” /debug+ /debug:full /filealign:512 /
optimize- /out:obj\Debug\Example.Tests.dll /subsystemversion:6.00 /target:lib
rary /utf8output AnimalTests.cs Properties\AssemblyInfo.cs “C:\Users\tiwarash
ext\AppData\Local\Temp\491.NETFramework,Version=v4.5.AssemblyAttributes.cs”
AnimalTests.cs(2,7): error CS0246: The type or namespace name ‘NUnit’ could not
be found (are you missing a using directive or an assembly reference?) [C:\New
folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-windows\b
in\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(9,10): error CS0246: The type or namespace name ‘Test’ could not
be found (are you missing a using directive or an assembly reference?) [C:\New
folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-windows\b
in\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(9,10): error CS0246: The type or namespace name ‘TestAttribute’
could not be found (are you missing a using directive or an assembly reference?
) [C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-
windows\bin\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(22,10): error CS0246: The type or namespace name ‘Test’ could no
t be found (are you missing a using directive or an assembly reference?) [C:\Ne
w folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-windows
bin\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(22,10): error CS0246: The type or namespace name ‘TestAttribute’
could not be found (are you missing a using directive or an assembly reference
?) [C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227
-windows\bin\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(6,3): error CS0246: The type or namespace name ‘TestFixture’ cou
ld not be found (are you missing a using directive or an assembly reference?) [
C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-win
dows\bin\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(6,3): error CS0246: The type or namespace name ‘TestFixtureAttri
bute’ could not be found (are you missing a using directive or an assembly refe
rence?) [C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0
.1227-windows\bin\Example.Tests\Example.Tests.csproj]
Done Building Project “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar
-scanner-3.2.0.1227-windows\bin\Example.Tests\Example.Tests.csproj” (Rebuild ta
rget(s)) – FAILED.

Done Building Project “C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar
-scanner-3.2.0.1227-windows\bin\Example.sln” (Clean;Rebuild target(s)) – FAILE
D.

Build FAILED.

“C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wi
ndows\bin\Example.sln” (Clean;Rebuild target) (1) ->
“C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wi
ndows\bin\Example.Tests\Example.Tests.csproj” (Rebuild target) (3:2) ->
(ResolveAssemblyReferences target) ->
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targe
ts(1635,5): warning MSB3245: Could not resolve this reference. Could not locate
the assembly “nunit.framework, Version=3.0.5813.39031, Culture=neutral, Public
KeyToken=2638cd05610744eb, processorArchitecture=MSIL”. Check to make sure the
assembly exists on disk. If this reference is required by your code, you may ge
t compilation errors. [C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar
-scanner-3.2.0.1227-windows\bin\Example.Tests\Example.Tests.csproj]

“C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wi
ndows\bin\Example.sln” (Clean;Rebuild target) (1) ->
“C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wi
ndows\bin\Example.Tests\Example.Tests.csproj” (Rebuild target) (3:2) ->
(CoreCompile target) ->
AnimalTests.cs(2,7): error CS0246: The type or namespace name ‘NUnit’ could n
ot be found (are you missing a using directive or an assembly reference?) [C:\N
ew folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-windows
\bin\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(9,10): error CS0246: The type or namespace name ‘Test’ could n
ot be found (are you missing a using directive or an assembly reference?) [C:\N
ew folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-windows
\bin\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(9,10): error CS0246: The type or namespace name 'TestAttribute
’ could not be found (are you missing a using directive or an assembly referenc
e?) [C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.122
7-windows\bin\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(22,10): error CS0246: The type or namespace name ‘Test’ could
not be found (are you missing a using directive or an assembly reference?) [C:
New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-window
s\bin\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(22,10): error CS0246: The type or namespace name ‘TestAttribut
e’ could not be found (are you missing a using directive or an assembly referen
ce?) [C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.12
27-windows\bin\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(6,3): error CS0246: The type or namespace name ‘TestFixture’ c
ould not be found (are you missing a using directive or an assembly reference?)
[C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-w
indows\bin\Example.Tests\Example.Tests.csproj]
AnimalTests.cs(6,3): error CS0246: The type or namespace name ‘TestFixtureAtt
ribute’ could not be found (are you missing a using directive or an assembly re
ference?) [C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2
.0.1227-windows\bin\Example.Tests\Example.Tests.csproj]

1 Warning(s)
7 Error(s)

Time Elapsed 00:00:02.07

C:\New folder\sonar-scanner-cli-3.2.0.1227-windows\sonar-scanner-3.2.0.1227-wind
ows\bin>

Can you please suggest why build is failing

Hi @ashwinn.tiwari,

your building is failing so the analysis cannot run successfully, you should get a successful build before trying to analyze.