How to enable own rules set for StyleCop.Analyzers in AspNetCore? The analysis works but with a default set of rules.
Asked
Active
Viewed 2,558 times
1 Answers
5
In a Project.json file:
"buildOptions": {
"additionalArguments": [ "/ruleset:../../_shared/RULES.ruleset", "/additionalfile:../../_shared/stylecop.json" ]
}
See: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/Configuration.md

Skorunka František
- 5,102
- 7
- 44
- 69
-
This worked for me too. The documentation at the link you provided no longer mentions `"buildOptions"` in the `project.json` file. However if you add the line you mention the rules will be checked at build. Another thing to note is that the paths seem to be based on the location of the `project.json` file – QueueHammer Oct 04 '16 at 21:35
-
@QueueHammer, thanks for giving the path of the relative location. They really should specify that. – tylerjgarland Oct 20 '16 at 18:13
-
Hi, looks like you got StyleCop.Analyzers to work with Asp.Net.Core. Can you please help me with: http://stackoverflow.com/questions/40379981/enabling-stylecop-analyzers-on-asp-net-core-projects ? – Tudor Nov 02 '16 at 13:11
-
1Considering migration to new csproj format, what are the steps to include ruleset? – xumix Apr 12 '17 at 12:10
-
1@xumix check this out: http://stackoverflow.com/questions/43227639/supporting-roslyn-analyzers-ruleset-in-visual-studio-2017-net-core-projects/43227687#43227687 – Skorunka František Apr 13 '17 at 20:05
-
@SkorunkaFrantišek Thanks! – xumix Apr 14 '17 at 08:23