1

I have problem with integration the newest version StyleCop with Visual Studio 2013 Ultimate. I have also installed Re# 9.

This answer not working on my pc :/

I have installed StyleCop nuget packages. enter image description here

I changed entry "True" in csproj file (by notepad). It works I get many error from StyleCop.

1) Why StyleCop is not integrated with Visual Studio? I should see "Run StyleCop" option in context menu on project, I do not see. 2) How can I determine path for my setting file in csproj?

Community
  • 1
  • 1
Jacek
  • 11,661
  • 23
  • 69
  • 123
  • 1
    In your screenshot it lists stylecop as an installed package. Setting that property to true in csproj will stop your project from building if stylecop finds warnings in your code. – Glen Thomas Aug 10 '15 at 22:36
  • Yes, it works. My purpose is to have StypeCop integrated with Visual Studio to can manage rules in easy way. – Jacek Aug 12 '15 at 18:46
  • Ok, I think I understand your question now. I thought you were saying stylecop is not working – Glen Thomas Aug 12 '15 at 19:06
  • I have this set up at work. I will have a look tomorrow and let you know how it is in my Visual Studio – Glen Thomas Aug 12 '15 at 19:55
  • Great, I appreciate your help – Jacek Aug 13 '15 at 07:54

2 Answers2

2

The nuget package StyleCop.MSBuild simplifies the adding of the properties to a csproj required to run StyleCop as part of the build. It also references a StyleCop instance inside /packages/ which means that it is downloaded from sourcecontrol and each developer does not need StyleCop installed.

R# by itself doesn't have any StyleCop settings, however it's ruleset can be configured to match StyleCop's. The easiest way to do this is with a plugin. This is currently in prerelease for R# 9.1 so make sure you have Include prelease plugins checked inside R# Settings > Environment > Extension Manager.

To get the context menus, you need to install StyleCop on your local machine. This currently does not support Visual Studio 2015.

It is important to keep the version used by R#, the version used by StyleCop.MsBuild and the version installed on your machine insync otherwise it will lead to false positives.

NikolaiDante
  • 18,469
  • 14
  • 77
  • 117
  • For context menus in VS2015, now you can try Visual-StyleCop. This extension is based from original source code from codeplex, I updated it to work with VS2015 and most common C# 6 specifications. To install it, start VS2015, go to Tools \ Extensions and update, and search for stylecop. More information on how to install it here : [http://stackoverflow.com/questions/31313249/stylecop-integration-with-visual-studio-2015-rc/32362690#32362690](http://stackoverflow.com/questions/31313249/stylecop-integration-with-visual-studio-2015-rc/32362690#32362690) – ptittof57 Sep 10 '15 at 19:18
  • Is there any way to run style cop with out installation (Like copying the dlls for StyleCop build) for creating custom rules? I need to run a simple custome rule. But my organization policy wont accept installations. – umsateesh Oct 07 '16 at 12:29
0

You should have 'Run StyleCop' options in the Tools menu and the context menu of the Solution Explorer. I have ReSharper installed, but I don't think it is ReSharper that adds these menu items. VS Express edition does not support integration of add-ins if you are using an Express/Community edition..

Context Menu

Tools Menu

Glen Thomas
  • 10,190
  • 5
  • 33
  • 65
  • Your screen show situation which I want to reach. I don't see this options. I use Visual Studio 2013 Ultimate. – Jacek Aug 13 '15 at 09:21
  • Do you install something more than this three nuget packages, which I have? – Jacek Aug 13 '15 at 09:26
  • I can't find any reason why you would not have the menu items. I'm guessing you have already tried uninstall and reinstall? – Glen Thomas Aug 13 '15 at 09:54