In my previous post, I explored how to create a minimalistic ReSharper plugin. After I published it, one of my colleagues inquired if it is possible to use this or any other plugin from ReSharper Gallery with inspectcode.exe from ReSharper Command Line Tools (RCLT). I didn’t know and decided to try it out. Here is what I learned.

The Fast Way

Download RCLT, copy a ReSharper extension (for example this one) next to inspectcode.exe and run it against the solution you want to analyze. That is all you need. However, there is a slightly more complex, but more robust way, which I implemented in a form of a simple tool. If you are going to use the tool or a similar solution in your continuous integration environment or just curious how it works, go to InspectCodeRunner.cs and read comments I left there. The devil is in the detail. For now, let’s have some fun and try it out try it out!

Step 1/4 Prepare a working directory

We are going to keep everything inside ‘RCLTTest’ folder. I’ll refer to it as base_dir throughout this guide.

mkdir RCLTTest
cd RCLTTest

Step 2/4 Install InspectCodeStarter

git clone

Step 3/4 Prepare project to inspect

git clone

ReSharper.ProjectUnderInspection contains a class named FooBar, which will be detected by ReSharper.FooDetector. The class FooBar also contains a method with a high cyclomatic complexity, which will be detected by PowerToys.CyclomaticComplexity plugin. We are going to install both plugins at step #4

Step 4/4 Run the inspection

ReSharper.InspectCodeStarter\inspect.bat ReSharper.ProjectUnderInspection\ProjectUnderInspection.csproj --base-dir=. --plugin=ReSharper.FooDetector.2018.1.0 --plugin=PowerToys.CyclomaticComplexity.2018.1.0 --output=res.html --format=html

This command does 3 actions:

  1. Installs RCLT into base_dir\JetBrains.ReSharper.CommandLineTools.
  2. Installs extensions specified in command line into base_dir\Plugins.
  3. Activates plugings and runs inspectcode.exe against base_dir\ReSharper.ProjectUnderInspection\ProjectUnderInspection.csproj.

When the inspection is finished, inspectcode.exe produces the base_dir\result.html as requested by –format=html –output=res.html.

Warnings within the red bars produced by ReSharper.FooDetector and PowerTows.CycolmaticComplexity