Roslyn: How to fix RS2008 warning?
Asked Answered
C

1

7

This question is also asked here: https://github.com/dotnet/roslyn/issues/57292

In Roslyn 3.8.0, there is RS2008 warning (Enable analyzer release tracking for the analyzer project containing rule 'EO0001') for the following code:

internal static class Rules
{
    public static readonly DiagnosticDescriptor InvalidFieldAttribute = new DiagnosticDescriptor(
        DiagnosticIds.InvalidFieldAttribute,
        new LocalizableResourceString(nameof(Resources.InvalidFieldAttribute_Title), Resources.ResourceManager, typeof(Resources)),
        new LocalizableResourceString(nameof(Resources.InvalidFieldAttribute_Message), Resources.ResourceManager, typeof(Resources)),
        DiagnosticCategories.Usage, DiagnosticSeverity.Warning, isEnabledByDefault: true);
}

Press CTRL-. to quick fix by adding the following two files:

AnalyzerReleases.Shipped.md:

; Shipped analyzer releases
; https://github.com/dotnet/roslyn-analyzers/blob/master/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md

## Release 1.0

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|--------------------
OE0001  |  Usage   |  Warning | InvalidFieldAttribute

AnalyzerReleases.Unshipped.md:

; Unshipped analyzer release
; https://github.com/dotnet/roslyn-analyzers/blob/master/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md

However the RS2008 warning is still there.

What am I missing?

Cherisecherish answered 21/10, 2021 at 4:2 Comment(0)
C
8

Got the answer from https://github.com/dotnet/roslyn/issues/57292 by adding AdditionalFiles in the project file:

<ItemGroup>
  <AdditionalFiles Include="AnalyzerReleases.Shipped.md" />
  <AdditionalFiles Include="AnalyzerReleases.Unshipped.md" />
</ItemGroup>
Cherisecherish answered 21/10, 2021 at 7:23 Comment(1)
For me the error also goes away when I just create the two files mentioned above without also adding them in the csproj file.Ptisan

© 2022 - 2025 — McMap. All rights reserved.