question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

stylecop.json seems to be ignored

See original GitHub issue

I’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:closed
  • Created 8 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

27reactions
vweijsterscommented, Nov 3, 2015

Not sure what is happening. Could you try and edit the .csproj file so that it adds the stylecop.json file as AdditionalFiles? See the sample below what that should look like. Also make sure that the stylecop.json entry is not combined with other entries in the same ItemGroup.

<ItemGroup>
  <AdditionalFiles Include="stylecop.json" />
</ItemGroup>
1reaction
mattdufeucommented, Nov 5, 2015

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found