16667

How to use the StyleCop Plugin with the Resharper command line or “InspectCode” tool

Question:

We use Resharper with the StyleCop plugin. It works great inside Visual Studio without any problems.

Now I'd like to get statistics about our projects. I am building all our solutions from the command line and so far managed to get the output from the compiler (warnings) static code analysis (ex FxCop) and unit testing (results and coverage).

JetBrains offers a commandline tool that does code analysis for free (<a href="http://blog.jetbrains.com/dotnet/2013/03/26/resharper-code-analysis-goes-beyond-visual-studio/" rel="nofollow">Link</a>).

I'm using it and it works as expected.

The command line version does not recognize my StyleCop plugin and it's rules. That's obvious, it's a different folder. So I copied my plugins folder at

<blockquote>

C:\Program Files (x86)\JetBrains\ReSharper\v8.2\Bin\Plugins\StyleCop 4.7

</blockquote>

over from my Resharper installation into the command line tool's .\Bin\Plugins\StyleCop 4.7 and it works... the command line tool recognizes the plugin and loads it. However, the plugin then cannot find the StyleCop assemblies. They were default-installed into

<blockquote>

C:\Program Files (x86)\StyleCop 4.7

</blockquote>

Resharper itself in Visual Studio can somehow auto-detect them.

I tried copying the StyleCop assemblies to the same folder that the commandline exe is in. Nothing changed.

I tried copying the StyleCop assemblies next to the StyleCop Plugin assembly. That worked in a way. The StyleCop plugin found it's StyleCop assemblies, but the command line tool complained because it tried to load every single assembly in that folder as plugin.

<strong>So how do I get the command line tool to work with the StyleCop plugin?</strong>

If there is a better option, I do have a full license, I'm happy about any hint how to do this with the free command line tool or the normal Resharper full version as long as I can start it from a batch file without having to open the Visual Studio GUI.

Answer1:

Current State

Resharper recognized this is a problem with their tool. The Issue # is <a href="https://youtrack.jetbrains.com/issue/RSRP-436208" rel="nofollow">RSRP-436208</a>.

It's not fixed as of 2017.1.1.

Workaround

When a Nuget package ( extension .nupkg ) is found in the tool's folder, it is expanded automatically in some temporary location. It's assemblies are then used with the tool.

So any *.nupkg of a plugin that resides in the tool folder should work.

Recommend

  • IntelijIdea 14 ssl handshake failure
  • What is the `console` tab evaluation environment
  • Jacoco is reporting 0 coverage of Kotlin classes by unit tests, in an Android project
  • Change model name in rails easily
  • Cover report from Common Test when using rebar
  • Angular Universal : How to resolve missing names, modules and other weird things
  • OpenCover takes much longer to run than the nunit-console
  • filter/remove invalid xml characters from stream
  • How to inject activity into another class using dagger.android?
  • Date api for managing off days in an year?
  • ZXING intent request code (identifying my intent)
  • Can't connect Entity Framework to local SQL Server Express
  • Send multimedia commands
  • Sympy: working with equalities manually
  • How to validate a year I enter in textbox using jquery rule?
  • Laravel at least one field is required
  • Efficient User-Agent Regex to find Safari in Python
  • What is the difference between a “service account” and an “installed application”?
  • Is it possible to get the word under the mouse cursor in a ``?
  • abstracting over a collection
  • Is there some graphical way to create my own configuration file on SonarLint?
  • DIV instruction jumping to random location?
  • Invalid object name 'dbo.Item'
  • htaccess add www if not subdomain, if subdomain remove www
  • Webgrid not refreshing after delete MVC
  • PHP buffered output depending on server setting?
  • Functions in global context
  • Jquery UI tool tip close icon
  • why overloaded new operator is calling constructor even I am using malloc inside overloading functio
  • formatting the colorbar ticklabels with SymLogNorm normalization in matplotlib
  • JavaScriptCore crash on iOS9
  • Is possible to count alias result on mysql
  • Check if a string to interpolate provides expected placeholders
  • Deserializing XML into class C#
  • Can I have the cursor start on a particular column by default in jqgrid's edit mode?
  • Traverse Array and Display in markup
  • How to include full .NET prerequisite for Wix Burn installer
  • Qt: Run a script BEFORE make
  • costura.fody for a dll that references another dll
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize