SonarQube MSBuild 扫描仪在预处理后停止

SonarQube MSBuild scanner stopping after pre-processing

我正在尝试在我们的 tfs 构建服务器上设置 SonarQube,它在预处理成功后一直停止扫描。我正在使用 MSBuild.SonarQube.Runner.exe。根本没有错误消息。没有迹象表明有任何问题。我不确定从这里去哪里。哈尔普?

您看到的输出没有任何问题。你只是遗漏了一些点点滴滴。

The “begin” invocation sets up the SonarQube analysis. Mandatory analysis settings such as the SonarQube project key, name and version must be passed in, as well as any optional settings, such as paths to code coverage reports. During this phase, the scanner fetches the quality profile and settings to be used from the SonarQube server.

Then, you build your project as you would typically do. As the build happens, the SonarQube Scanner for MSBuild gathers the exact set of projects and source files being compiled and analyzes them.

Finally, during the “end” invocation, remaining analysis data such as Git or TFVC one is gathered, and the overall results are sent to the SonarQube server.

Source

简而言之,在第一次命令调用(开始)之后,您需要 运行 MSBuild 14.0 并构建您的解决方案,然后完成调用(结束)并在您的文件中查看分析结果SonarQube 服务器,如果一切顺利的话。

# This is part of the pre-build script
> MSBuild.SonarQube.Runner.exe begin /k:project_key /n:project_name /v:project_version

# Build your solution here
> msbuild /t:rebuild

# This is part of the post-build script
> MSBuild.SonarQube.Runner.exe end

理想情况下,该小脚本应该成为构建管道的一部分(使用 Jenkins、TeamCity 或任何 CI 工具)。

希望对您有所帮助!