Introduction to the SonarScanner for .NET
On this page
Even if you’re already familiar with SonarQube and SonarCloud, analyzing a .NET application is a little different than when analyzing other languages. Whereas the SonarScanner normally scans existing code or already built projects, the SonarScanner for .NET analyzes the code while the build is in process. The SonarScanner for .NET makes it easy to manage the analysis of your .NET projects including projects using multiple languages, without needing any additional tool or resource.
The SonarScanner for .NET is the recommended way to launch an analysis for projects built using MSBuild
or dotnet
. It is the result of a collaboration between SonarSource and Microsoft.
The SonarScanner for .NET is distributed as a .NET Core Global Tool, in the Sonar extension for Azure DevOps, and in the Sonar extension for Jenkins.
It supports .NET Core on every platform (Windows, macOS, Linux).
Analysis process with the SonarScanner for .NET
To run an analysis using the SonarScanner for .NET, you first need to make your code analysis work and set up your PR decoration. The final step is to integrate the coverage import.
- Install the prerequisites in your environment (Java).
- Download the correct SonarScanner version for your .NET runtime, and install it on your CI.
- Then work on your pipeline;
- specify your Begin step arguments to prepare your project for analysis,
- Build your project which will generate the analysis data,
- and define the End step arguments to collect the analysis data.
- Finally, focus your analysis as part of your build process by setting up your test coverage using a third-party tool to access important metrics.
Related pages
Installing the SonarScanner for .NET
Was this page helpful?