In SonarQube analysis, I have set sonar.inclusions=**/*.cs
to include all files with the .cs
extension. SonarQube scans the properties with .cs
files, and the files in the App_Code
folder are listed in the SonarQube code section. However, the lines of code for each file in the App_Code
folder are shown as zero, even though these .cs
files contain lines of code. Why are the .cs
files in the App_Code
folder not being scanned correctly?
Hey there.
The template post isn’t just there for show.
Must-share information (formatted with Markdown):
- which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension)
In any case, when analyzing .NET Code with the SonarScanner for .NET, you shouldn’t ever need to specify sonar.inclusions
(and I expect bad behavior if you do).
Are you using the Scanner for .NET?
I am currently using SonarQube server version 9.9.3.79811 along with the SonarScanner for .NET. By default, the scanner automatically analyzes .cs
files. However, I also need to include other file extensions such as .js
, .css
, and .html
in the same analysis. To achieve this, I have included all the necessary extensions in the SonarQube inclusions.
I want to know why the file (.cs) inside the App_code folder are skipped ??
Hi there, @David15
The files in the App_Code folder are dynamically compiled at run time by the ASP.NET framework.
Since they are not compiled at build time, they do not get analyzed by the Scanner for .NET, whether you use inclusions (which are not actually supported by the Scanner, by the way) or not.
We have no support for WebForms because of that particular, legacy behavior, unfortunately.
Denis
thanks dennis for the proper explaination