Overview

Running .NET analysis on SonarQube Server can be tricky to set up. This page gives you an overview of what’s required depending on your .NET framework.

The .NET SDK is a framework for C# and Visual Basic (VB.NET) programming languages to run on. The .NET APIs have undergone an evolution beginning as the .NET Framework (versions 1 - 4.62) and .NET Core (versions 1-3.1), before eventually being released simply as .NET (beginning as version 5).

To run a .NET analysis with Sonar, you must download and install the SonarScanner for .NET; the installation process will be different as determined by your .NET environment.

After installing the prerequisites, you must download and install the correct SonarScanner. Then, depending on your CI integration, different steps must be taken to make the SonarScanner work properly. For example, if you intend to run your analysis with GitHub Actions, you’ll need to configure your GitHub workflow build.yml. See the Configuring the build.yml file article in the GitHub integration pages.

If your build environment is on Azure DevOps, our Marketplace extension, the Azure DevOps Extension page, and the Azure DevOps integration pages will be an invaluable resource.

The SonarScanner

Even if you’re already familiar with SonarQube Server and SonarQube Cloud, analyzing a .NET application is a little different than when using the SonarScanners for Maven or Gradle. Whereas the SonarScanner normally scans existing code or projects that are already built, the SonarScanner for .NET analyzes the code while the build is in process.

Once the build is complete and your code is analyzed, results are gathered by the SonarScanner running on your CI and sent to SonarQube Server (or SonarQube Cloud) for review. The analysis processes are integrated with the build and it is expected that your build time will increase by a factor of three or four times; this is normal because it takes extra time to run the analysis during the build process.

After you’ve run your first analyses and sent the results to SonarQube Server (or SonarQube Cloud) to check, you can focus the analysis as part of your build process by setting up .NET test coverage using a third-party tool to access important metrics.

Taking your first steps

Take a look at the Getting started with .NET page to learn about configuring your pipeline, running code coverage, and generating reports. Then use the SonarScanner for .NET pages to reference the technical details about using the scanner.

Last updated

Was this helpful?