C#
Language-specific information about the way that SonarQube Cloud supports analysis of C#.
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
To discover and update the C#-specific properties, navigate in SonarQube Cloud to Your Project > Administration > General Settings > Languages > C#. See the Analysis parameters page for more information about specific properties.
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 > Administration > General Settings > C#. By default, tool-generated code files are skipped during analysis.
The detection of generated code is based on the file name, special comments, and attributes. The currently recognized values are in GeneratedCodeRecognizer.cs.
Scanner compatibility
To analyze C# code, you need to use the SonarScanner for .NET, version 4.x or newer.
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. Details about inclusions and exclusions can be found on the Analysis scope pages.
As an alternative, a .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.
[Path/File.cs]
dotnet_diagnostic.Sxxx.severity = none
Related pages
Importing external issues: External analyzer reports (NUnit, MSTest, xUnit)
For excluding external Roslyn issues: External analyzer reports. See also Notes on external .NET (C# or VB.NET) issues
C / C++ / Objective-C test coverage (Visual Studio Code Coverage, dotCover, OpenCover, Coverlet, Altcover, VSTest)
The Azure DevOps Extension for SonarQube Cloud
Specifying test projects (the page is in the SonarQube Server docs, but also applies when setting up SonarQube Cloud .NET projects)
Last updated
Was this helpful?