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 not being picked up in old visual studio csproj (non-dotnet core)

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
UmairBcommented, Sep 6, 2017

Ok yes. That did it. I need to go through the ruleset in more detail. Thank you again!

0reactions
sharwellcommented, Sep 6, 2017

@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.

Read more comments on GitHub >

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

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