Jenkins MSBuild SonarQube Runner 1.0.2 projectinfo.xml 找不到文件

Jenkins MSBuild SonarQube Runner 1.0.2 projectinfo.xml file not found

我在 jenkins 中遇到问题 运行 sonarqube msbuild runner v1.0.2。 构建运行良好,但插件似乎没有正确导入声纳目标。

这是声纳构建开始时的日志:

[workspace] $C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\MSBuild.SonarQube.Runner.exe begin /k:my.project /n:myprojectname /v:1.0 /d:sonar.host.url=http://1.1.1.1:9000/ 
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
Checking for updates...
MSBuild SonarQube Runner Pre-processor 1.0.2.0
10:17:18.025  Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
10:17:18.056  Updating build integration targets...
10:17:18.072  Fetching analysis configuration settings...
10:17:21.332  Generating rulesets...
Pre-processing succeeded.
Path To MSBuild.exe: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
Executing the command cmd.exe /C " C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Development /t:Clean,Build /tv:14.0 /p:VisualStudioVersion=14.0 /m:1 /fl2 /flp2:verbosity=diagnostic myprojectname.sln " && exit %%ERRORLEVEL%% from C:\.jenkins\jobs\Technology - WWW - Content Store Client\workspace
[workspace] $ cmd.exe /C " C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Development /t:Clean,Build /tv:14.0 /p:VisualStudioVersion=14.0 /m:1 /fl2 /flp2:verbosity=diagnostic ContentStoreClientSolution.sln " && exit %%ERRORLEVEL%%
Microsoft (R) Build Engine version 4.6.81.0...

这里是 if 结束时:

[workspace] $ C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\MSBuild.SonarQube.Runner.exe end 
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Post-processing started.
No ProjectInfo.xml files were found. Possible causes: you specified an invalid build configuration or the custom MSBuild analysis targets were not imported. 
MSBuild SonarQube Runner Post-processor 1.0.2.0
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
10:21:04.257  Creating a summary markdown file...
Post-processing failed. Exit code: 1
ERROR: Execution of MSBuild SonarQube Runner failed (exit code 1)

插件自行安装在 jenkins 的 tools 子文件夹中。但是,在项目工作区中,我可以看到一个名为 .sonar 的文件夹,其中似乎包含所有正确的文件和目标等。

关于构建失败的原因有什么想法吗?

您至少需要使用 MSBuild 12(版本 14,与 VS 2015 一起发布将为您提供适用于 MSBuild 和 C# 插件 4.4 的 SonarQube Scanner 1.1 版的更准确的分析结果)。

未为 MSBuild 4.0 部署 ImportsBefore 目标 - 这就是在 MSBuild 执行期间未收集任何信息的原因。我们不会添加对 MSBuild 4.0 或更早版本的支持。

请注意,在即将推出的 SonarQube Scanner for MSBuild 1.1 版本中,提到 ProjectInfo.xml 的错误消息已得到很大改进,让您了解潜在的根本原因:请参阅 https://jira.sonarsource.com/browse/SONARMSBRU-180