Search code examples
visual-studio-2015resharperstylecopmethodnotfound

R# & StyleCop issue: Method not found


I have recently downloaded R# 9.1 in order to integrate StyleCop into it. Everything passed well when I was installing both R# and its extension for StyleCop. However, when I go to my solution folder (in Visual Studio 2015) and right-click on one of my projects and click on "Run StyleCop" it displays this error:

Error message: Method not found

Initially I installed R# 9.2 and the result was the same, so I decided to go to 9.1 version. I reinstalled R# and StyleCop both once and multiple times the R#'s extension for integrating StyleCop.


Solution

  • My current set up for R# and StyleCop is:

    • Resharper 10.0.1
    • StyleCop by JetBrains 4.8

    enter image description here

    Which gives this in R# options: enter image description here

    This gives me R# validation of rules.

    However, this doesn't give me right click run functionality.

    So I had a click look around and found that StyleCop doesn't have an install for VS 2015, so I installed Visual StyleCop and have recreated your issue. If you are using Visual StyleCop it may be worth while adding an issue on their github.

    enter image description here

    Personally, I don't use the right click functionality, instead I get the warnings from a build via the StyleCop.MSBuild nuget package for each project I want to monitor:

    enter image description here

    Once I have no errors, I use StyleCop.Error.MSBuild to keep it that way, again from nuget:

    enter image description here

    The more modern way of doing this is to make use of the Analyzers feature of Visual Studio 2015, with StyleCop.Analyzers.

    enter image description here

    Even the Stylecop by Jet brains one treats this as the preferred implementation.. From the R# gallery

    Automatically disable analysis if StyleCop.Analyzers is referenced in VS2015 (#20)

    Moving to Stylecop.Analyzers, this would add them into the rules in the relevant *.ruleset file (same place as CodeAnalysis rules)

    enter image description here

    and you can run them via

    enter image description here

    Which has the same effect as right click Run StyleCop which you are trying to get working.

    I.e. giving:

    enter image description here

    Any clarifications or further detail, please let me know.