We are running SonarScanner for .NET inside a Jenkins Declarative Pipeline on a Windows build agent.
After the scan completes (dotnet sonarscanner end), the Jenkins post‑build cleanup step fails because DLLs inside:
.sonarqube/bin/
— especially Newtonsoft.Json.dll — remain locked by SonarScanner/MSBuild/dotnet processes.
We cannot kill dotnet.exe or SonarScanner.MSBuild.exe using taskkill because multiple Sonar scans and .NET builds may be running concurrently on the same agent.
Looking for an official recommendation from SonarSource on how to reliably ensure .sonarqube/bin is unlocked on Windows before workspace cleanup
Environment
SonarQube Server Version: Enterprise Edition v2025.3.1 (109879)
SonarScanner for .NET: via dotnet sonarscanner
Build Tool: Cake
Jenkins: Declarative + Shared Libraries
Jenkins Agent OS: Windows Server
Workspace Layout:
D:/Apps/Jenkins/<job>/<build>/...
Command used:
bat “${dotnet} sonarscanner begin /k:${projectKey} /d:sonar.cs.opencover.reportsPaths=${coverageReportPath}”
bat “${dotnet} cake --target Test --nuget_source=${NugetUrl}”
bat “${dotnet} sonarscanner end”
Jenkins logs-
2026-03-04 13:30:01 D:\Apps\JenkinsAKSPRD\GEBE_formbuilder_backend_CI_Pipeline_feature_cicd_workspace_issue\8>“C:\Program Files\dotnet\dotnet.exe” sonarscanner begin /k:belfius.gebe.formbuilder.backend /d:sonar.cs.opencover.reportsPaths=**/coverage/*.xml
2026-03-04 13:30:03 SonarScanner for .NET 11.1
2026-03-04 13:30:03 Using the .NET Core version of the Scanner for .NET
2026-03-04 13:30:03 Pre-processing started.
2026-03-04 13:30:03 Preparing working directories…
For the sake of i-dotting, can you provide a full, verbose analysis log, please?
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.