Start Free
Latest | Analyzing source code | Scanners | SonarScanner for .NET | Introduction

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.

  1. Install the prerequisites in your environment (Java).
  2. Download the correct SonarScanner version for your .NET runtime, and install it on your CI.
  3. 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.
  4. 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. 

Installing the SonarScanner for .NET

Using the SonarScanner for .NET

Configuring the SonarScanner for .NET


Was this page helpful?

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARLINT, SONARQUBE, SONARCLOUD, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License