Stylecop.json not being picked up in old visual studio csproj (non-dotnet core)
See original GitHub issueI am trying to use the analyzers with a previous csproj project, pre dotnet core version. So far my updated csproj looks like this
Ruleset
<CodeAnalysisRuleSet>$(SolutionDir)\..\References\StyleCop\StyleCop.ruleset</CodeAnalysisRuleSet>
stylecop json
<AdditionalFiles Include="$(SolutionDir)\..\References\StyleCop\stylecop.json">
<Link>stylecop.json</Link>
</AdditionalFiles>
As well as the analyzer dlls
<ItemGroup>
<Analyzer Include="..\..\packages\StyleCop.Analyzers.1.0.2\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\..\packages\StyleCop.Analyzers.1.0.2\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
Here are the contents of my json file
"settings": {
"documentationRules": {
"documentInterfaces": true,
"documentExposedElements": true,
"documentInternalElements": true,
"fileNamingConvention": "metadata",
"companyName": "ABC",
"xmlHeader": false
},
"orderingRules": {
"usingDirectivesPlacement": "preserve",
"blankLinesBetweenUsingGroups": "omit"
},
"namingRules": {
"allowCommonHungarianPrefixes": true,
"allowedHungarianPrefixes": [
"i",
"oa",
"sp",
"z"
]
}
}
Non of the rules in the json file are being applied.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Intellisense keep suggest "Add StyleCop settings file to the ...
My project config as: 1. Micorsoft.CodeAnalysis.FxCopAnalyzers in the Directory.Build.props file, not in csproj file. 2. Additional file: ...
Read more >NET 6 StyleCop.Analyzers ignores "documentationCulture"
Straightforward solution. It seems to be a known StyleCop.Analyzers issue: GitHub issue: SA1642: Language ignored in .
Read more >StyleCop: A Detailed Guide to Starting and Using It
We'll get into what this means exactly, but first a little word about the “old” and the “new” StyleCop. StyleCop used to be...
Read more >Is ReSharper really needed since Visual Studio has been ...
TBH I use Rider a lot of the time if I'm not working on Xaml (Rider's Xaml support pretty much sucks plus being...
Read more >How to Correctly Include stylecop.json Into Your Project
Unfortunately, due to a bug in Roslyn there is some extra work you must do or your customised rules will not work. First,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok yes. That did it. I need to go through the ruleset in more detail. Thank you again!
@UmairB Since you are using version 1.0.2, rule SA0001 is actually SA1652. We renumbered it for 1.1.x. You’ll need to enable SA1652 to get diagnostics when using the old version.