SonarCloud | Advanced setup | CI-based analysis | SonarScanner for .NET | Installing the scanner
Installing the SonarScanner for .NET
On this page
Prerequisites
- From version 7.0, Java is no longer required because the scanner will download it automatically.
- If internet access is limited in your configuration, skip the JRE provisioning and use the Java version installed locally.
- The SDK corresponding to your build system:
- For the .NET Framework v4.6.2: use either the Build Tools for Visual Studio 2015 Update 3, or the Build Tools for Visual Studio.
- If you are using the .NET version of the scanner or the .NET Core Global Tool, you will need .NET Core SDK 3.1 and above.
The flavor (either .NET Framework, .NET Core or .NET) used to compile the Scanner for .NET is independent of the .NET version used to build the project you want to analyze. Concretely, you can analyze .NET Core code with the .NET Framework version of the Scanner. It's only relevant depending on your OS, and on the versions of .NET SDKs that are installed on your build machine.
Installation
.NET Core Global Tool
dotnet tool install --global dotnet-sonarscanner --version x.x.x
The --version
argument is optional. If it is omitted, the latest version will be installed. A complete list of releases is available on the NuGet page.
The .NET Core Global Tool is available from .NET Core 3.1+.
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:
- Add
$install_directory
to yourPATH
environment variable.
Related pages
Introduction to the SonarScanner for .NET
Was this page helpful?