SonarQube.Scanner.MSBuild 连续调用失败;无法清理 .sonarqube 目录

SonarQube.Scanner.MSBuild fails on successive invocations; unable to clean .sonarqube dir

基本上,我需要连续调用3次msbuild。三个构建中的每一个都需要扫描。第一个没问题,但第二个和第三个失败,因为扫描器无法清理 .sonarqube 目录。
我得到“访问路径 'SonarQube.Common.dll' 被拒绝。 看起来 .dll 仍在使用中,即使我在构建之间设置了 60 秒的延迟。

这是输出的片段:

C:\home\repos\SteveKTemp>SonarQube.Scanner.MSBuild.exe begin /k:com.carestream.SteveK_Backend /n:SteveK_Backend /v:1.0 /s:C:\home\repos\SteveKTemp\src\Backend_Sonar_Properties.xml 
SonarQube Scanner for MSBuild 3.0.2
Loading analysis properties from C:\home\repos\SteveKTemp\src\Backend_Sonar_Properties.xml
sonar.verbose=true was specified - setting the log verbosity to 'Debug'
Pre-processing started.
Preparing working directories...
Using environment variables to determine the download directory...
Removing the existing directory: C:\home\repos\SteveKTemp\.sonarqube
Creating directory: C:\home\repos\SteveKTemp\.sonarqube
12:50:27.707  12:50:27.703  Loading analysis properties from C:\home\repos\SteveKTemp\src\Backend_Sonar_Properties.xml
12:50:27.707  12:50:27.707  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
12:50:27.708  Updating build integration targets...
12:50:27.709  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\rocbuilder\AppData\Local\Microsoft\MSBuild.0\Microsoft.Common.targets\ImportBefore
12:50:27.709  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\rocbuilder\AppData\Local\Microsoft\MSBuild.0\Microsoft.Common.targets\ImportBefore
12:50:27.71  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\rocbuilder\AppData\Local\Microsoft\MSBuild.0\Microsoft.Common.targets\ImportBefore
12:50:27.711  Installed SonarQube.Integration.targets to C:\home\repos\SteveKTemp\.sonarqube\bin\targets
12:50:27.712  Creating config and output folders...
...

C:\home\repos\SteveKTemp>SonarQube.Scanner.MSBuild.exe end 
SonarQube Scanner for MSBuild 3.0.2
Default properties file was found at C:\SonarQube\Scanners\sonar-scanner-msbuild-3.0.2.656\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarQube\Scanners\sonar-scanner-msbuild-3.0.2.656\SonarQube.Analysis.xml
Post-processing started.
12:52:04.002  Loading the SonarQube analysis config from C:\home\repos\SteveKTemp\.sonarqube\conf\SonarQubeAnalysisConfig.xml
12:52:04.003  Not running under TeamBuild
12:52:04.004  Analysis base directory: C:\home\repos\SteveKTemp\.sonarqube
Build directory: 
Bin directory: C:\home\repos\SteveKTemp\.sonarqube\bin
Config directory: C:\home\repos\SteveKTemp\.sonarqube\conf
Output directory: C:\home\repos\SteveKTemp\.sonarqube\out
Config file: C:\home\repos\SteveKTemp\.sonarqube\conf\SonarQubeAnalysisConfig.xml

...
:: CAUSE A DELAY BETWEEN 1st and 2nd Scan

C:\home\repos\SteveKTemp>PING localhost -n61  1>NUL 


C:\home\repos\SteveKTemp>SonarQube.Scanner.MSBuild.exe begin /k:com.carestream.SteveK_WebCSharp /n:SteveK_WebCSharp /v:1.0 /s:C:\home\repos\SteveKTemp\src\Web_Sonar_Properties.xml 
SonarQube Scanner for MSBuild 3.0.2
Loading analysis properties from C:\home\repos\SteveKTemp\src\Web_Sonar_Properties.xml
sonar.verbose=true was specified - setting the log verbosity to 'Debug'
Pre-processing started.
Preparing working directories...
Using environment variables to determine the download directory...
Removing the existing directory: C:\home\repos\SteveKTemp\.sonarqube
Failed to create an empty directory 'C:\home\repos\SteveKTemp\.sonarqube'. Please check that there are no open or read-only files in the directory and that you have the necessary read/write permissions.
  Detailed error message: Access to the path 'SonarQube.Common.dll' is denied.
Pre-processing failed. Exit code: 1

如果能找到解决此问题的方法,我将不胜感激。

谢谢。

我看到他们在连续 运行 多个构建时推荐了一个额外的选项。

pass /nodereuse:false to msbuild

查看故障排除: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild