Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StyleCop integration with Visual Studio 2015 RC

I want to integrate my instance of VS 2015 RC with StyleCop in the way that I have StyleCop menu options [Run StyleCop, Run StyleCop (Rescan All), StyleCop Settings] available when right clicking on project in Solution Explorer. Installing StyleCop-4.7.49.0.msi from official StyleCop site adds proper options for VS 2013 but not for 2015. Is it possible to achieve that?

like image 536
leszek Avatar asked Jul 09 '15 09:07

leszek


People also ask

Is StyleCop still used?

StyleCop used to be a Visual Studio plugin and a NuGet package. You can still use this in Visual Studio 2019, but the current recommended way to use StyleCop is to use the Roslyn-based analyzers.

How do you integrate StyleCop in Visual Studio 2019?

Go to project references, find analyzers, right click on it and select Open Active Rule Set, then you can disable\enable rules if styleCop is installed.


2 Answers

If it can help you, I have created a fork of StyleCop from CodePlex. My version works now with VS2015 and support most of new C# 6 specifications. Like version 4.7.49.0, you can right click on your project and you can find "Run StyleCop, Run StyleCop (Rescan All) or Edit settings" menus.

How to install it :

  1. Start VS2015
  2. Go to Tools and select "Extensions and Updates..." menu
  3. Select "Online" then "Visual Studio Gallery" on the left list
  4. In search box enter : "StyleCop"
  5. Select and download "Visual StyleCop"
  6. Then right click on your project and run StyleCop

If you have any issue you can report it on GitHub, project name : Visual StyleCop.

like image 131
ptittof57 Avatar answered Oct 05 '22 08:10

ptittof57


Installed VS2015 Community release recently. Since StyleCop project does not list 2015 as supported I digged further.

And found solution. It is StyleCopAnalyzers that can be installed via nuget (make sure that you click "include prerelease" checkbox) on per project basis. This is interesting solution and I like how it looks.

Downside is that it is not possible to just use old Settings.StyleCop and it took me some searching how to configure rules. And I found this blog post. Basically you expand your references list. Then right click on the Analyzers create ruleset and you have .ruleset file in the project.

like image 27
Sergey Novikov Avatar answered Oct 05 '22 07:10

Sergey Novikov