A Cake AddIn that allows will run the Sonar MSBuild Runner for csharp projects.

#addin nuget:?package=Cake.Sonar&version=1.1.33

dotnet add package Cake.Sonar --version 1.1.33

<PackageReference Include="Cake.Sonar" Version="1.1.33" />


Contains functionality for running a Sonar analysis on a c# project using the MSBuild SonarQube Runner.

In order to use the commands for this addin, include the following in your build.cake file to download and reference from

#addin "nuget:?package=Cake.Sonar"
#tool "nuget:?package=MSBuild.SonarQube.Runner.Tool"

SonarScanner for MSBuild

Sonar(Action<ICakeContext>, SonarBeginSettings) Run a self-contained analysis for the specified action. The action should run msbuild.
SonarBegin(SonarBeginSettings) Initialise msbuild for sonar analysis.
SonarEnd(SonarEndSettings) Run the actual sonar analysis and push them to sonar. This call should follow after a SonarBegin and MSBuild.
SonarEnd() Run the actual sonar analysis (no credentials given).