Configuring Stylecop Analyzer in Visual Studio 2022

Viewed 51

I've created a new solution in Visual Studio 2022, and am following this guide to try and get Stylecop Analyzer to apply a custom style set.

According to the guide, you can point projects to a stylecop configuration file via the visual studio project settings:

enter image description here

However, in Visual Studio 2022 the project settings > code analysis looks very different and doesn't include an option to run any particular rule set:

enter image description here

Instead, I've tried to configure stylecop by editing each project file to include the location of the file in the solution root:

  <ItemGroup>
    <AdditionalFiles Include="..\..\..\stylecop.json" Link="stylecop.json" />
  </ItemGroup>

I've double-checked the folder structure to make sure that's the right file path. However, even after all this, stylecop analyzer still seems to be applying the default ruleset rather than the custom one intended.

Is there any way I can point my projects to the desired file from inside VS2022? If not, what am I doing wrong here, and what is needed for me to pick up the custom file?

0 Answers
Related