Whether it is possible to analyze only “.cs” files in SonarQube,

Hi Team,

I am using SonarQube version 8.9 LTS.

Please suggest on whether it is possible to analyze only “.cs” files of a .NET Framework project in SonarQube without using .sln or .csproj files?

Sonar uses Roslyn based analyzers to analyze C# files. Those are triggered running a the dotnet build command. Theoretically you can compile C# files without a MS build file, but it is not advised and I guess Sonar has not built-in solution for it…

Thanks for reply.

Is there any way to analyze only .CS files.

No. You must use the SonarScanner for .NET, which will require a build of your code (a valid .NET project with a solution or project file, not just raw .cs files)

I’m wondering though: why do you want to analyze some C# files without building them in the first place?

Thanks Colin.