stylecop.json seems to be ignored
See original GitHub issueI’ve created a stylecop.json via the recommended “Add StyleCop settings file to the project” and configured it to be:
{
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"documentationRules": {
"companyName": "ANYTHING",
"copyrightText": "Copyright (c) {companyName}. All rights reserved."
}
}
}
Unfortunately the following header violates SA1636:
// <copyright file="BundleConfig.cs" company="ANYTHING">
// Copyright (c) ANYTHING. All rights reserved.
// </copyright>
What am I doing wrong?
Issue Analytics
- State:
- Created 8 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
stylecop.json seems to be ignored · Issue #1896
Hi folks, probably user error but stylecop.json is just not working for me. I followed Configuration.md for easy creation of json file.
Read more >Stylecop.json setting is ignored during code cleanup and ...
Ok, it seems that it's a misunderstanding. That's not an integration, we just run StyleCop Analyzers as we would run any Roslyn analyzers...
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 >How to Correctly Include stylecop.json Into Your Project
While it is sometimes annoying, it is the simplest way we found to enforce code style guidelines. Since we use it in all...
Read more >Intellisense keep suggest "Add StyleCop settings file to the ...
I'm using Code Analysis (Microsoft.CodeAnalysis.FxCopAnalyzers) and StyleCop (StyleCop.Analyzers) both, but this seems cause by CodeAnalysis ...
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
Not sure what is happening. Could you try and edit the .csproj file so that it adds the
stylecop.json
file asAdditionalFiles
? See the sample below what that should look like. Also make sure that thestylecop.json
entry is not combined with other entries in the sameItemGroup
.After some digging, @vweijsters was right.
For a Web Application project, the stylecop.json file is created with a “Build Action” configuration of “Content”. Changing this to “Additional Files” fixed my issue.
For a Class Library project, the stylecop.json file is created with a “Build Action” configuration of “None”. That seems to work fine.
Thanks for your help.