Start FreeLog in
SonarCloud | Advanced setup | CI-based analysis | SonarScanner for .NET | Installing the scanner

Installing the SonarScanner for .NET

On this page

Prerequisites

Installation

.NET Core Global Tool

Using the dotnet install tool from the command line is the simplest way to install the scanner if you are using .NET Core or later on an already installed instance of SonarQube. The .NET Core Global Tool is available from .NET Core 3.1+.

dotnet tool install --global dotnet-sonarscanner --version x.x.x

The --version argument is optional; if omitted, the latest version will be installed. The full list of release versions is available on the NuGet page.

If you can't use the dotnet install tool, other Core versions are available for download in the SonarScanner Update Center collapsible (access above, select Show more). 

Standalone executable

  • Expand the downloaded file into the directory of your choice. We'll refer to it as $install_directory in the following steps.
    • On Windows, you might need to unblock the ZIP file first (right-click File > Properties > Unblock).
    • On Linux/OSX you may need to set execute permissions on the files in $install_directory/sonar-scanner-(version)/bin.
  • Uncomment, and update the global settings to point to SonarCloud by editing $install_directory/SonarQube.Analysis.xml. Values set in this file will be applied to all analyses of all projects unless overwritten locally.
    Consider setting file system permissions to restrict access to this file:
<SonarQubeAnalysisProperties  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
  <Property Name="sonar.host.url">https://sonarcloud.io</Property>
  <Property Name="sonar.token">[my-user-token]</Property>
</SonarQubeAnalysisProperties>
  • Add $install_directory to your PATH environment variable.

Introduction to 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