This version of the SonarQube documentation is no longer maintained. It relates to a version of SonarQube that is not active.

Introduction

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 Configuring the scanner, 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 Sonar and Microsoft.

The SonarScanner for .NET is distributed as a .NET Core Global Tool, in the Sonar SonarQube extension for Azure DevOps, and in the Sonar SonarQube 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.

  1. Installing the scanner in your environment (Java).

  2. Download the correct SonarScanner version for your .NET runtime, and install it on your CI.

  3. Then Using the scanner;

    • 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.

  4. Finally, focus your analysis as part of your build process by setting up your .NET test coverage using a third-party tool to access important metrics.

Installing the scanner

Using the scanner

Configuring the scanner

Last updated

Was this helpful?