Unable to Scan C# Project Files Along with .htm, .js, .css Files

I’m using SonarQube Community Edition (9.9.3.79811), I have project with C# sharp code along with .htm, .js, .css .I am using the CLI mode using sonarscanner for scanning the code.I am unable to scan all the C# project files along with .htm, .js, and .css files together. However, I can scan the C# project files and the .htm, .js, and .css files separately.

Could you please provide guidance on how to resolve this issue?

Hi,

Welcome to the community!

To analyze the C# code, you must use SonarScanner for .NET. If you use the latest version of the scanner, it will automatically pick up your HTML, CSS &etc. However, you may need to adjust the recognized suffixes for HTML, since it doesn’t look like .htm is one of them. You’ll find it under Languages at either the global or project admin levels.

 
HTH,
Ann

Hi Ann

Could you provide more info, how this can be done. I have the same issue. There is a project with multiple type of code files C#, JavaScript, TypeScript, HTML, CSS, etc,. I am using the CLI mode with SonarQube Community Edition(v25.4)

It is skipping the C# files stating:

INFO: Sensor C# [csharp] 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
INFO: Sensor C# [csharp] (done) | time=0ms

I downloaded the .NET Core 3.1+ and tried analysing with it

/bin/sonar-scanner.bat -D"sonar.projectKey=<project-key>" -D"sonar.sources=." -D"sonar.host.url=http://localhost:9000" -D"sonar.token=<sonar-token>"

But it skipped the C# file again.

Do I need to download another scanner?

like .NET Framework 4.6.2+

What is required to analyse the C# files?

Hi @vkr,

Welcome to the community!

You’ve resurrected a 4-month-old thread. Per the FAQ, please don’t do that. Please create a new thread with all your details.

 
Thx,
Ann