.NET analysis overview
On this page
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 environment, 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 a build.yml file; if your build environment is on Azure DevOps, our Marketplace Extension and the Azure DevOp integration docs will be an invaluable resource.
The SonarScanner
Even if you’re already familiar with SonarQube, 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 (or SonarCloud) 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 (or SonarCloud) to check, you can focus the analysis as part of your build process by setting up 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.
Related pages
Was this page helpful?