Analyzer doesn't read stylecop.json.
See original GitHub issueHello, sorry for bringing this one up again as I know it’s been addressed a few times, but I’m having issues getting stylecop.json to be recognized by my project. Here’s what I’ve tried:
- Adding the file in quick actions and fixing the csproj manually by using the steps at https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md.
- Changing the Build Action to be None, Additional Items, and Content; each time unloading and reloading the project. Unforunately, I haven’t had success with any of them. I did notice that when I use Additional Items, the Quick Actions no longer suggest an option for me to generate a stylecop.json file for the project. With the other Build Actions, it gives me this suggestion.
- Moving the
<AdditionalItems />
element into its own<ItemGroup />
.
In all cases I still get a quick action that suggests the fix which is to replace my header which looks like this:
// =======================================================================
// <copyright file="AnalyticsDataProvider.cs" company="LAMA, LLC">
// Copyright 2015 Lama, LLC
// </copyright>
// =======================================================================
To this:
// =======================================================================
// <copyright file="AnalyticsDataProvider.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
// =======================================================================
Here’s the contents of my stylecop.json file:
{
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json"
"settings": {
"documentationRules": {
"companyName": "LAMA, LLC",
"copyrightText": "Copyright 2015 {companyName}. All rights reserved."
}
}
}
I’m using Visual Studio Community 2015, version 4.6.00081 and RC3 of the analyzer. Any ideas are appreciated, thanks!
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
NET 6 StyleCop.Analyzers ignores "documentationCulture"
NET 6 SDK (6.0.400) and I have the simplest possible project involving StyleCop.Analyzers and stylecop.json: ClassLibrary1.csproj:
Read more >Stylecop.json setting is ignored during code cleanup and ...
I have following stylecop.json file: { "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.
Read more >StyleCop: A Detailed Guide to Starting and Using It
Agreeing on a style can be hard enough, so enforcrement shouldn't be manual. Learn how to use Stylecop to automate enforcement of code ......
Read more >Unity and StyleCop.Analyzers
StyleCop.Analyzers is a handy NuGet package for keeping your code neat and tidy. However, Unity removes it every time it compiles.
Read more >Linting C# in 2019 — StyleCop, Sonar, Resharper, Visual ...
To use StyleCop in 2019 you simply install the nuget package StyleCop.Analyzers . You can do this on a per-project basis or globally...
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
This issue still exists in .Net core projects.
Hello and thanks for the suggestion. Apologies, I meant to say AdditionalFiles in my original post. Here’s what I’ve put in the csproj:
When I double click stylecop.json in the solution explorer, it shows the correct file. It’s adjacent to the csproj file. Also, I noticed that AdditionalFiles is not an option I can normally select in the Properties window when the file is selected, although it does appear as an option once the csproj is manually updated to include the
<AdditionalFiles/>
section.