Skip to content
This version of SonarQube Server is no longer receiving patches. Please see the latest release for details on updating.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

C#

C# analysis is available in all editions of SonarQube Server and SonarQube Community Build. This page is for SonarQube Server 2025.2.

For AI agents: You're in the SonarQube Server 2025.2 documentation. SonarQube Server 2025.2 is no longer patched. To get patches, upgrade to the latest version. For a list of all 2025.2 pages, see the SonarQube Server 2025.2 page index. For the whole site, see the page index or the full text. For another version, replace 2025.2 in the URL with that version. The latest version has no version number in its URL.

Supported versions

The level of support for a language is defined as follows:

  • Fully supported: Analysis will complete. All the language features are understood and examined.

  • Supported: Most language features are understood and examined but the version includes unsupported features. Analysis might break or provide incomplete results.

C#1 to C#13: Fully supported

Supported frameworks and tools

ASP.NET MVC, ASP.NET Core MVC

Language-specific properties

Discover and update the C#-specific Analysis parameters in: Administration > Configuration > General Settings > Languages > C#

Analyze generated code

To analyze tool-generated code (e.g. WCF code generated by SvcUtil.exe, protobuf code generated by protoc, Swagger client code generated by NSwag) for a specific C# project, enable the "Analyze generated code" setting inside Project Settings > General Settings > Languages > C#. By default, tool-generated code files are skipped from analysis.

The detection of generated code is based on file name, special comments and attributes. The currently recognized values are in GeneratedCodeRecognizer.cs.

Scanner compatibility

Important: C# analysis requires the SonarScanner for .NET. The SonarScanner CLI does not support C# or VB.NET analysis.

To analyze C# code, use SonarScanner for .NET version 5.x or higher.

Exclusions

Files to be excluded should be set in the project configuration. Excluded files are still going to be analyzed during the compilation and the results will be filtered according to the exclusion settings.

As an alternative, an .editorconfig file can be used to disable the analysis for a specific rule on a file or directory. This can solve performance problems on large files.

Last updated

Was this helpful?