如何在 Jenkins 中为 MSBuild 的声纳扫描仪设置本地模块目录?

How do I set Local module directory for sonar scanner for MSBuild in Jenkins?

我的 jenkins 项目进行了 2 次检查,一次来自框架,一次来自使用该框架的应用程序 A。

我想 运行 应用程序 A 上的声纳扫描仪。

我在 jenkins 中有 6 个构建步骤

Execute Windows batch command : nuget.exe restore "%WORKSPACE%\Framework\branches.0.1.0\Framework.sln"

Execute Windows batch command : nuget.exe restore "%WORKSPACE%\AppUsingFramework\branches\v1.1.3\AppUsingFramework.sln"

Build a Visual Studio project or solution using MSBuild : build framework

SonarQube Scanner for MSBuild - Begin Analysis // HOW DO I SET THE FOLDER TO %WORKSPACE%\AppUsingFramework\branches\v1.1.3 ?

Build a Visual Studio project or solution using MSBuild : build the application
MSBuild Build File  : AppUsingFramework\branches\v1.1.3\AppUsingFramework.sln

SonarQube Scanner for MSBuild - End Analysis

我收到这条消息:

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 14.0 upwards are supported
  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.

所以我怀疑我应该在启动声纳时指定工作文件夹 (%WORKSPACE%\AppUsingFramework\branches\v1.1.3),我该怎么做?

我使用:

詹金斯 2.60.2

SonarQube Scanner for MSBuild 3.0.1.635(从 github 自动安装)

MSBuild 15

通过删除不必要的构建框架步骤(它已经内置在应用程序中)并且仅指定 AppUsingFramework.sln 而没有路径,声纳扫描成功。