使用 Roslyn 分析器诊断 Sonarqube

Diagnosing Sonarqube with Roslyn analyzers

我正在为我的团队设置 Sonarqube,运行 在使用 the Sonarqube Roslyn SDK found on github 时遇到问题。

按照github页面上的说明,我已经成功编译了解决方案。但是,当 运行 在 [目录]/Sonarqube.Plugins.Roslyn.PluginGenerator.exe 中使用生成器工具时,我在尝试按照 Microsoft.CodeAnalysis.Analyzers:

的说明创建插件时收到以下错误
c:\users\[HomeDirectory]\src\github\sonarqube-roslyn-sdk\RoslynPluginGenerator\bin\Debug\sonarqube.plugins.roslyn.plugingenerator.exe /a:c:\users\[HomeDirectory]\src\github\sonarqube-roslyn-sdk\RoslynPluginGenerator\bin\Debug\Microsoft.CodeAnalysis.Analyzers:1.0.0
Roslyn Analyzer Plugin Generator for SonarQube 0.1.0.0
    [DEBUG] Parsed NuGet reference. Id: c:\users\[HomeDirectory]\src\github\sonarqube-roslyn-sdk\RoslynPluginGenerator\bin\Debug\Microsoft.CodeAnalysis.Analyzers, version: 1.0.0
    [DEBUG] Fetching NuGet config files...
    [DEBUG] Enabled package sources:
    [WARNING] No enabled package sources. Please update the NuGet config to specify at least one valid package source.
    Attempting to locate package with id 'c:\users\[HomeDirectory]\src\github\sonarqube-roslyn-sdk\RoslynPluginGenerator\bin\Debug\Microsoft.CodeAnalysis.Analyzers'
    [DEBUG] Number of packages located: 0
    No packages with the specified id were found:
    c:\users\[HomeDirectory]\src\github\sonarqube-roslyn-sdk\RoslynPluginGenerator\bin\Debug\Microsoft.CodeAnalysis.Analyzers

我在 Visual Studio 中没有遇到其他 NuGet 问题,并且在机器上启用了正确的 (v3) 包源。我知道 Sonarqube Roslyn SDK 目前是测试版,但想知道是否有人真的成功地从引用的 NuGet 库创建了一个插件。

附带说明一下,Sonarqube 工作得很好,只是我无法将基于分析器的静态分析问题引入 Sonarqube。此问题特定于 SDK。任何见解将不胜感激。

在发布原始问题后,Roslyn SDK 已修复此问题。只需按照 SDK github 页面上提供的说明进行操作即可。