Sonar scanner for .NET Core in Jenkins Pipeline

Hi all,

I’m facing an issue triggering sconascanner for dotnet from my Jenkins pipeline
I’m not able to dynamically set the project Key during the scan ‘/k:’ for the projectKey
How can I fetch the project key? I’m looking at something like the below to trigger my scan where ${project_key} can be obtained from the project

bat label: ‘’, script: “cmd.exe /C dotnet sonarscanner begin /k:{project_key} /{buildConfig.sonarUrl} /d:sonar.login=${sonarkey}”

Also, When I try to include in the repo, the execution fails with the following error

Using the .NET Core version of the Scanner for MSBuild
Post-processing started. files are not understood by the SonarScanner for MSBuild


Hello @krishnaarani
From what I understand, there is two questions here :

Your projectKey can be retrieved from your SonarQube project overview, here :

Yes, with the scanner for MSBuild, you pass all parameters from the command-line, exactly the way you did it.

Hope to help.


Thanks Christophe

I was looking at a dynamic way to fetch the “project-key” to trigger the scan through Jenkins pipeline.
After adding the “PackageReference” in the .csproj for sonarqube scanner tool, a “.sonarqube” folder gets generated with the run which contains “SonarQubeAnalysisConfig.xml” containing all the sonarqube configurations, including the SonarProjectKey. Looks something like below. My question was more towards, how I can grab the Project key from the properties into the SonarScanner “/k:” while we trigger the scan


<PackageReference Include="MSBuild.SonarQube.Runner.Tool" Version="4.8.0" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="">
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PackageReference Include="SonarQube.Scanner.DotNetCore.Tool" Version="4.3.1" />


<?xml version="1.0" encoding="utf-8"?> <--> <--> <--> <--> true <--> <--> true .ts,.tsx .groovy SonarQube false false 60 true target/jacoco-it.exec SonarAnalyzer.CSharp false false .css,.less,.scss false And many more propreties....