基本上,我需要连续三次调用msbuild。需要扫描三个构建中的每一个。第一个是OK,但第二个和第三个失败,因为扫描程序无法清理.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\15.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\14.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\12.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
我非常感谢您找到解决此问题的方法。
谢谢。
答案 0 :(得分:2)
我看到他们在连续运行多个构建时还有一个额外的选项。
pass /nodereuse:false to msbuild
见疑难解答: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild