简体   繁体   English

SonarQube MSBuild集成失败-具有Scanner 4.0.2.892和VS2017的SonarQube 7

[英]The SonarQube MSBuild integration failed - SonarQube 7 with Scanner 4.0.2.892 and VS2017

I'm using SonarQube 7.0 and SonarQube Scanner for MSBuild 4.0.2.892 and attempting to follow these instructions to scan my .NET application on Windows (ASP.NET Core). 我将SonarQube 7.0和SonarQube Scanner用于MSBuild 4.0.2.892,并尝试按照以下说明在Windows(ASP.NET Core)上扫描.NET应用程序。 The three commands below are part of the instructions: 以下三个命令是说明的一部分:

C:\SonarQube\Scanner\SonarQube.Scanner.MSBuild.exe begin /k:"org.sonarqube:sonarqube-scanner-msbuild" /n:"TradingPlatform" /v:"1.0"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" /t:Rebuild
C:\SonarQube\Scanner\SonarQube.Scanner.MSBuild.exe end

However, while pre-processing succeeds on the fist command, and the build completes on the second command, the third command always fails as shown below: 但是,尽管在fist命令上预处理成功,并且在第二条命令上构建完成,但是第三条命令始终失败,如下所示:

==== ====

SonarQube Scanner for MSBuild 4.0.2 Default properties file was found at C:\\SonarQube\\Scanner\\SonarQube.Analysis.xml 用于MSBuild 4.0.2的SonarQube扫描仪默认属性文件位于C:\\ SonarQube \\ Scanner \\ SonarQube.Analysis.xml

Loading analysis properties from C:\\SonarQube\\Scanner\\SonarQube.Analysis.xml 从C:\\ SonarQube \\ Scanner \\ SonarQube.Analysis.xml加载分析属性

Post-processing started. 后处理开始。

The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects. SonarQube MSBuild集成失败:SonarQube无法收集有关您的项目的必需信息。

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. 使用了不支持的MSBuild版本来生成项目。 Currently MSBuild 14.0 upwards are supported 当前支持MSBuild 14.0或更高版本
  3. The begin, build or end steps have not all been launched from the same folder 尚未从同一文件夹启动所有开始,构建或结束步骤

Generation of the sonar-properties file failed. 声纳属性文件的生成失败。 Unable to complete SonarQube analysis. 无法完成SonarQube分析。

Exit Code 1. 退出代码1。

==== ====

Does anyone have any idea why it's failing? 有谁知道为什么它会失败? Cause 1 can't be the case as I'm building the project in step 2. Cause 2 seems very unlikely (but not impossible) as I'm using MSBuild 15. Cause 3 also can't be the case as I'm running all three commands from the same location 由于在步骤2中构建项目时,原因1不可能是这种情况。由于使用MSBuild 15,原因2似乎不太可能(但并非不可能),因为我使用MSBuild 15时,原因3也不可能这样。从同一位置运行所有三个命令

Other possible reasons are: 其他可能的原因是:

  • your build server is executing the builds using Local System account. 您的构建服务器正在使用本地系统帐户执行构建。 Try changing the build user to a normal domain or local user. 尝试将生成用户更改为普通域或本地用户。
  • you are building a .NET Core project that has no ProjectGuid property (the default) and that is not part of a solution. 您正在构建的.NET Core项目没有ProjectGuid属性(默认设置),并且不属于解决方案。 To resolve this you need to do one of these: 要解决此问题,您需要执行以下一项操作:
    • Add <ProjectGuid>XXXXX</ProjectGuid> element in the first PropertyGroup in your csproj, where XXXXX is a newly generated Guid. 在csproj的第一个PropertyGroup中添加<ProjectGuid>XXXXX</ProjectGuid>元素,其中XXXXX是新生成的Guid。
    • Add your project to a Visual Studio solution and build the sln file instead of the csproj 将您的项目添加到Visual Studio解决方案,并生成sln文件而不是csproj

If this does not help, add /d:sonar.verbose=true on the begin command of the scanner and save all logs into a file. 如果这样做没有帮助, /d:sonar.verbose=true在扫描仪的begin命令上添加/d:sonar.verbose=true并将所有日志保存到文件中。 Zip the logs and the .sonarqube folder from your build workspace and upload them here: https://www.dropbox.com/request/CszJAO1ZNXFVl1gwo5hA 从您的构建工作区压缩日志和.sonarqube文件夹,并将其上传到此处: https : .sonarqube

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM