Sonarqube no line code with C#

Description

Hello.
SonarScanner works without errors.
Only warning:

Property missing: 'sonar.cs.analyzer.projectOutPaths'. No protobuf files will be loaded for this project.

But in Sonarqube code has not been analysed.

Repro steps

Please provide the steps required to reproduce the problem

1. "D:\sonar\sonar-scanner-msbuild-4.6.2.2108-net46\SonarScanner.MSBuild.exe" begin /k:skills /n:skills /v:\"1\" /d:sonar.language=cs  /d:sonar.exclusions=**/*Test*/** /d:sonar.sourceEncoding=UTF-8
2. "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\MSBuild.exe" WB.production.sln /t:Clean,Rebuild" 
3. "D:\sonar\sonar-scanner-msbuild-4.6.2.2108-net46\SonarScanner.MSBuild.exe" end

If possible then please create a git repository with a repro sample or attach a zip to the issue.

Expected behavior

Analyzed only dependencies

Actual behavior

All C# code has been analyzed

Known workarounds

no idea

Related information

  • SonarC# 7.10
  • Visual Studio Version 2017
  • MSBuild 15.9.21.664
  • SonarScanner for MSBuild 4.6.2
  • SonarQube 7.5

Full log with --verbose attached here https://github.com/SonarSource/sonar-dotnet/issues/2667

hi @peter-iglaev welcome to the community.

it’s better not to cross-post on both github and here - if you post on community, it’s enough

what are the contents of the .sonarqube\out folder? There should be multiple subfolders numbered starting from 0 for each csproj you have in the solution, and each should have FilesToAnalyze.txt and ProjectInfo.xml.

Inside ProjectInfo.xml, you can check

  <AnalysisSettings>
    <Property Name="sonar.cs.roslyn.reportFilePath"><PATH_TO_PROJ>\bin\Debug\net46\SonarAnalyzer.Utilities.dll.RoslynCA.json</Property>
    <Property Name="sonar.cs.analyzer.projectOutPath"></Property>
  </AnalysisSettings>

Do you have that SonarAnalyzer.Utilities.dll.RoslynCA.json in your bin folders?

The way the analyzer works is:

  • the sonar-csharp analyzer is a Roslyn analyzer that outputs the results in the json during the build phase
  • during the end step, Scanner for MSBuild calls the SQ plugin which parses that report and pushes to SQ