Issue trying to scan .NET Core project

The previous thread from Sept 2020 on this error does not answer my question.

I am using

  • Sonarqube Version 8.7 (build 41497)
  • Sonarscanner for .NET Core 2+ (sonar-scanner-msbuild-5.1.0.28487-netcoreapp2.0)
  • OpenJDK 11.0.2
  • Command line operation on Windows. No IDE. No CI/CD tool.

I have also tried using: sonar-scanner-msbuild-5.1.0.28487-net5.0. Results are the same.

My project is built using .NET Core 2.1.1.
I get these warning messages when I run the scanner:

WARN: No protobuf reports found. The C# files will not have highlighting and metrics.
WARN: No Roslyn issue reports were found. The C# files have not been analyzed.
WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html

Hi @Subbu and welcome to the community !

Multiple questions here :

  • Are you correctly running the scanner begin step before the build, and the end step after ?
  • By chance, do you have any /p:RunAnalyzersDuringBuild=true set anywhere on a commandline or inside a csproj ?
  • Are you running the analysis from the root folder of your solution? (you can check if you have any .sonarqube folder at this root leve)

Mickaël

Hi Mickael,
Thx for the prompt response. Here are the answers:

  • I run the sonar-scanner batch file (that came with the downloaded scanner) with the correct “-Dsonar.login” value
  • I do not have /p:RunAnalyzersDuringBuild=true set anywhere on a commandline or inside a csproj
  • Yes, I am running the analysis from the root folder of my solution (which has my .sln file, and multiple folders each with a .csproj file)
  • Yes, I can find a .scannerwork folder alongside my .sln file (no .sonarqube folder)
  • When I run the scanner with DEBUG, I do see
    My C# files being indexed with language ‘cs’,
    Messages saying my cs files generated metadata with charset ‘UTF-8’, and
    Message saying Property missing: 'sonar.cs.analyzer.projectOutPaths

Hi,

You need to run SonarScanner.MSBuild.dll to have the “proper” scanner.

You can find the documentation here : SonarScanner for .NET | SonarQube Docs

Is that what you did already ?

Mickaël

Perfect Mickael! This worked. Thank you

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.