1
votes

I installed the ReSharper plugin StyleCop by JetBrains to include StyleCop directly into all of our projects, without the need to have the same settings.stylecop or stylecop.json file in multiple projects (since our guidelines are basically identical for all of our projects).

I ran into an issue regarding StyleCop and after posting an issue on the Github page of the plugin I got told that I should use StyleCop.Analyzers since the plugin has been discontinued.

Now I have the following problem. Do I need to explicitly include a corresponding stylecop.json file within each of our projects to make StyleCop work with the newest features? Or is there another way to tell ReSharper to use a default StyleCop configuration for all of our projects? I know it's not that big of a deal to add a file to a project. But it's a little bit tedious to have the same file within ~50ish projects and then change a single thing. Therefore it would be amazing to configure it in one single location.

1
Something to bear in mind: you are basically saying that all developers on your project need ReSharper (a paid product) to use your code. Are you sure you want that restriction? Many developers either do not have the funds or otherwise don't use ReSharper (it's an incredible memory/processor hog, and most of the features are available for free built into VS2019).Neil
@Neil We are in a closed environment, where everyone has an equally powerful machine. Also ReSharper licensing costs are not a problem since all of the developers are granted Visual Studio Enterprise as well as a ReSharper license.Zumpel
It must be nice to work in such an environment. All my previous dev machines ground to a halt as soon as RS was installed, and the teams gradually removed it as it was slowing them down. I've only just upgraded to a laptop that is powerful enough to work with it (12 cores/32 GB/SSD).Neil

1 Answers

2
votes

The StyleCop.Analyzers NuGet package works with or without ReSharper. It will give you far better control over which projects it should apply to. You can configure it by right clicking the rules under Dependencies->Analysers->StyleCop.Analysers in your solution explorer:

enter image description here

Once you change any configuration it will create a .editorconfig file for you which you could use to copy to all of your other projects if required.