如何让 Resharpers InspectCode 识别插件?

How to get Resharpers InspectCode to recognize Plugins?

我正在尝试 运行 ReSharpers 命令行工具 InspectCode.exe。它 运行ning 很好地完成了预期输出的工作。

然而,在我 earlier attempt 让插件工作之后,这次新版本应该支持它。命令行界面中有一个开关,允许指定您要使用的扩展。

/extensions (/x) – allows using ReSharper extensions that affect code analysis. To use an extension, specify its ID, which you can find by opening the extension package page in the ReSharper Gallery, and then the Package Statistics page. Multiple values are separated with the semicolon.

但我无法让它正常工作。我什至无法激起对 /x 开关的 any 反应。无论我如何通过或通过什么,我都不会从可执行文件中得到任何反馈,并且输出是相同的。传递明显的垃圾时,我什至没有收到错误消息。

我尝试了以下命令行以获得完全相同的结果:

inspectcode.exe /o="rcli.xml" /swea /x="ReSharper.StyleCop" "my.sln"

inspectcode.exe /o="rcli.xml" /swea /x=ReSharper.StyleCop "my.sln"

inspectcode.exe /o="rcli.xml" /swea "my.sln"

inspectcode.exe /o="rcli.xml" /swea /x=ABCDEFG "my.sln"

结果

JetBrains Inspect Code 9.1.1

Running in 64-bit mode, .NET runtime 4.0.30319.18444 under Microsoft Windows NT 6.1.7601 Service Pack 1

Enabled solution-wide analysis according to Inspect Code command line Setting.

Analyzing files

[files]

Inspection report was written to rcli.xml

我做错了什么?如何让扩展工作?

我已经尝试过 R# forums,但他们花了超过 24 小时才批准我的 post,到目前为止我不确定是否还有其他人阅读过它。

不幸的是,由于 "ReSharper platform" 中的重构,对扩展的支持在 9.0 中被删除。我希望 JetBrains 能尽快把它带回来。

RSRP-436208

这是一个迟到的答案,可能会对未来的读者(比如我自己)有所帮助。当前 inspectcode.exe 将自动查找并使用与可执行文件 (source) 位于同一文件夹中的任何 NuGet 包。

CleanCode 分机的示例:

  • 如果您在某台机器上有一个 R# 实例并安装了扩展,它将被放置在 C:\Users\{user}\AppData\Local\JetBrains\plugins\MO.CleanCode.5.6.15
  • 复制 MO.CleanCode.5.6.15.nupkg 并将其粘贴到 inspectcode.exe
  • 旁边
  • 当 运行 inspectcode with verbosity = VERBOSE 时,扩展名应该出现在 Zones 列表中:

    $cmd = "..\JetBrains.ReSharper.CommandLineTools.2019.3.4\inspectcode.exe" 
    $outputFile = "..\Output$($outputName).xml"
    & $cmd -o="$outputFile" $sln --verbosity=VERBOSE
    

Zones: (52pcs)[CodeInspectionPageImplZone, DaemonEngineZone, DaemonZone, IAmd64CpuArchitectureHostZone, IAspMvcZone, IBatchToolEnvironmentZone, IClrImplementationHost Zone, IClrPsiLanguageZone, ICodeEditingOptionsPageImplZone, IConsoleEnvironmentZone, ICppProductZone, ICpuArchitectureHostZone, IDocumentModelZone, IEnvironmentZone, IHostSolutionZone, IInspectCodeConsoleEnvironmentZone, IInspectCodeEnvironmentZone, IInspectCodeZone, ILanguageAspZone, ILanguageBuildScriptsZone, ILanguageCppZone, I LanguageCSharpZone, ILanguageCssZone, ILanguageHtmlZone, ILanguageIlZone, ILanguageJavaScriptZone, ILanguageMsBuildZone, ILanguageNAntZone, ILanguageProtobufZone, ILa nguageRazorZone, ILanguageRegExpZone, ILanguageResxZone, ILanguageVBZone, ILanguageXamlZone, INetFrameworkHostZone, INuGetZone, IOperatingSystemHostZone, IProjectMode lZone, IPsiAssemblyFileLoaderImplZone, IPsiLanguageZone, IPublicVisibilityZone, IRdFrameworkZone, IRiderModelZone, ISinceClr2HostZone, ISinceClr4HostZone, ITextContro lsZone, IToolsOptionsPageImplZone, IWebPsiLanguageZone, IWindowsNtHostZone, PsiFeaturesImplZone, ReplaceableByIntelliJPlatformZone, SweaZone] Packages: (23pcs)[JetBrains.ExternalAnnotations, JetBrains.Platform.Core.Ide, JetBrains.Platform.Core.IisExpress, JetBrains.Platform.Core.MsBuild, JetBrains.Platform. Core.Shell, JetBrains.Platform.Core.Text, JetBrains.Platform.Interop.CommandLine, JetBrains.Platform.Interop.dotMemoryUnit.Framework, JetBrains.Platform.Interop.dotMe moryUnit.Interop.Console, JetBrains.Platform.Interop.dotMemoryUnit.Interop.Ide, JetBrains.Platform.RdProtocol, JetBrains.Psi.Features.Core, JetBrains.Psi.Features.Cpp .Src.Core, JetBrains.Psi.Features.src, JetBrains.Psi.Features.Tasks, JetBrains.Psi.Features.UnitTesting, JetBrains.Psi.Features.Web.Core, JetBrains.ReSharperAutomatio nTools.src.CleanupCode, JetBrains.ReSharperAutomationTools.src.CommandLineCore, JetBrains.ReSharperAutomationTools.src.CommandLineProducts, JetBrains.ReSharperAutomat ionTools.src.DuplicatesFinder, JetBrains.ReSharperAutomationTools.src.InspectCode, MO.CleanCode]