sonar-scanner CLI reference
ModularPipelines.SonarScanner provides strongly typed access to the sonar-scanner CLI.
Executable prerequisite
This package does not install the sonar-scanner executable. Install it separately and ensure sonar-scanner is available on PATH.
The generation workflow is pinned to sonar-scanner version 8.0.1.6346.
See the sonar-scanner installation guide.
The generator workflow downloads the Linux x64 SonarScanner CLI distribution.
Package installation
dotnet add package ModularPipelines.SonarScanner
Resolve the service with context.Tools.SonarScanner. For projects older than C# 14, import ModularPipelines.SonarScanner.Extensions and use the context.SonarScanner() extension method as a compatibility fallback.
Module example
Resolve the service in a module, then select a command from the table below. A runnable example is omitted when no command has complete safety metadata:
var sonarScanner = context.Tools.SonarScanner;
Commands
| CLI command | Options record |
|---|---|
sonar-scanner | SonarScannerExecuteOptions |