SonarQube scanner for MSBuild:结束 MSBuild 集成失败



我在尝试执行SonarQube扫描仪时遇到问题。开始部分似乎运行没有问题,MSBuild 命令也是如此,但结束部分失败。

第一步:我执行以下 SonarQube 扫描仪命令:

D:workspaceMasterData>SonarQube.Scanner.MSBuild.exe begin /k:"masterdata" /n:"MasterData" /v:"1.0" /d:sonar.host.url=http: //xyz.com.br:9000/sonarqube /d:sonar.login=5773c2ca935fde42c72494a96de5a68a5b6899d1 /d:sonar.verbose=true
SonarQube Scanner for MSBuild 2.2
Default properties file was found at D:sonar-scanner-msbuild-2.2.0.24SonarQube.Analysis.xml
Loading analysis properties from D:sonar-scanner-msbuild-2.2.0.24SonarQube.Analysis.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: D:workspaceMasterData.sonarqube
Creating directory: D:workspaceMasterData.sonarqube
SonarQube server URL: http: //xyz.com.br:9000/sonarqube
SonarQube Scanner for MSBuild 2.2
15:11:10.032  Loading analysis properties from D:sonar-scanner-msbuild-2.2
.0.24SonarQube.Analysis.xml
15:11:10.04  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
15:11:10.042  Updating build integration targets...
15:11:10.045  Installed SonarQube.Integration.ImportBefore.targets to C:UsersAppDataLocalMicrosoftMSBuild14.0Microsoft.Common.targetsImportBefore
15:11:10.046  Installed SonarQube.Integration.ImportBefore.targets to C:Usersf
g009admAppDataLocalMicrosoftMSBuild12.0Microsoft.Common.targetsImportBefore
15:11:10.048  Installed SonarQube.Integration.targets to D:workspaceMasterData.sonarqubebintargets
15:11:10.049  Creating config and output folders...
15:11:10.049  Creating directory: D:workspaceMasterData.sonarqubeconf
15:11:10.049  Creating directory: D:workspaceMasterData.sonarqubeout
15:11:10.055  Fetching analysis configuration settings...
15:11:10.062  Fetching properties for project 'masterdata' from http: //xyz.com.br:9000/sonarqube/api/properties?resource=masterdata...
15:11:10.062  Downloading from http: //xyz.com.br:9000/sonarqube/api/properties?resource=masterdata...
15:11:10.214  Downloading from http: //xyz.com.br:9000/sonarqube/api/updatecenter/installed_plugins...
15:11:10.239  Fetching quality profile for project 'masterdata' from http: //xyz.com.br:9000/sonarqube/api/qualityprofiles/search?projectKey=masterdata...
15:11:10.24  Downloading from http: //xyz.com.br:9000/sonarqube/api/qu
alityprofiles/search?projectKey=masterdata...
15:11:10.272  Downloading from http: //xyz.com.br:9000/sonarqube/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=
500&activation=true&qprofile=cs-sbs-cs-default-201410-86215&p=1...
15:11:10.451  Downloading from http: //xyz.com.br:9000/sonarqube/api/rules/search?f=internalKey&ps=500&activation=false&qprofile=cs-sbs-cs-default-201410-86215&p=1&languages=cs...
15:11:10.506  Generating rulesets...
15:11:10.506  Generating the FxCop ruleset: D:workspaceMasterData.sonarq
ubeconfSonarQubeFxCop-cs.ruleset
15:11:10.518  Writing Roslyn generated ruleset to D:workspaceMasterData.sonarqubeconfSonarQubeRoslyn-cs.ruleset...
15:11:10.534  Writing Roslyn analyzer additional file to D:workspaceMasterData.sonarqubeconfcsSonarLint.xml...
15:11:10.536  Provisioning analyzer assemblies for cs...
15:11:10.538  Installing required Roslyn analyzers...
15:11:10.538  Local analyzer cache: C:Usersfg009admAppDataLocalTemp7.sonarqube.static
15:11:10.538  Processing plugin: csharp version 1.23.0.1828
15:11:10.54  Cache hit: using plugin files from C:UsersAppDataLocalTemp7.sonarqube.staticcsharp_1.23.0.1828SonarAnalyzer-1.23.0.1828.zip
15:11:10.566  Pre-processing succeeded.

第二步:我执行以下 MSBuild 命令:

MSBuild.exe /t:Rebuild MasterDataWebServices.sln

由于 MSBuild 日志非常大,因此我不会在此处提供它。显示"生成成功"消息,其中包含 5 个警告和 0 个错误。

第三步:我执行以下SonarQube扫描仪结束命令:

D:workspaceMasterData>SonarQube.Scanner.MSBuild.exe end
SonarQube Scanner for MSBuild 2.2
Default properties file was found at D:sonar-scanner-msbuild-2.2.0.24SonarQube.Analysis.xml
Loading analysis properties from D:sbs1sonar-scanner-msbuild-2.2.0.24SonarQube.Analysis.xml
Post-processing started.
SonarQube Scanner for MSBuild 2.2
14:25:22.961  Loading the SonarQube analysis config from D:workspaceMasterData.sonarqubeconfSonarQubeAnalysisConfig.xml
14:25:22.964  Not running under TeamBuild
14:25:22.964  Analysis base directory: D:workspaceMasterData.sonarqube
Build directory:
Bin directory: D:workspaceMasterData.sonarqubebin
Config directory: D:workspaceMasterData.sonarqubeconf
Output directory: D:workspaceMasterData.sonarqubeout
Config file: D:workspaceMasterData.sonarqubeconfSonarQubeAnalysisConfig.xml
Generating SonarQube project properties file to D:workspaceMasterData.sonarqubeoutsonar-project.properties
The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:
1. The project has not been built - the project must be built in between the begin and end steps
2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported
3. The begin, build or end steps have not all been launched from the same folder
Writing processing summary to D:workspaceMasterData.sonarqubeoutProjectInfo.log
Generation of the sonar-properties file failed. Unable to complete SonarQube ana
lysis.
14:25:22.988  Creating a summary markdown file...
14:25:22.989  Post-processing failed. Exit code: 1

我面临着同样的问题。就我而言,我安装了我的Sonar版本所需的相应MSBuild版本,并且运行良好。

我的SonarScanner需要14.0或更高版本的MSBuild,然后我下载了Microsoft构建工具2015。

在您的情况下,我相信这个版本也可以工作,如果没有,您可以更具体地尝试这个版本。

希望对您有所帮助。

最新更新