RDK0008 — Analyzer under a framework folder
Severity: warning · Command: redecker inspect
An analyzer assembly is packed under a target framework folder, where Roslyn will never look.
The mistake
The analyzers/ convention has nothing to do with target frameworks. Assemblies live under analyzers/dotnet/<language>/, optionally with a Roslyn version and a locale. A path like this is the lib/ layout applied by mistake:
analyzers/net8.0/Contoso.Analyzers.dll ← never loaded
analyzers/dotnet/net472/Contoso.Analyzers.dll ← same mistake, one level downThe analyzer ships, restore succeeds, the package installs — and your diagnostics never appear. That is indistinguishable from code with no problems, which is what makes it worth a rule.
What it deliberately does not do
It does not assert which layouts are valid. Surveying the 500 most-downloaded packages turned up at least six shapes, all working:
| Layout | Example |
|---|---|
analyzers/dotnet/cs | the common case |
analyzers/cs, analyzers/vb | Microsoft.VisualStudio.Threading.Analyzers |
analyzers/dotnet | System.Reactive, language-agnostic |
analyzers/dotnet/roslyn4.8/cs | Refit |
analyzers/dotnet/cs/de, /ja, /zh-Hans | System.Text.Json, localised resources |
analyzers/dotnet/roslyn4.4/cs/pt-BR | versioned and localised |
Encoding all of those would restate the convention rather than check it — and analyzers/dotnet/cs/cs is genuinely ambiguous, since that trailing cs is Czech, not C#.
A target framework moniker appears in none of the valid shapes. That makes it the one thing that can be called wrong without a lookup table, so it is the only thing this rule calls wrong.
Where it earns its place
On a package you are about to publish:
dotnet pack -c Release
redecker inspect --file ./artifacts/packages/*.nupkgA widely-used package with this mistake would have been reported and fixed years ago — which is exactly why sweeping established packages finds nothing, and exactly why that is not evidence the rule is pointless. A package being published for the first time has had no such scrutiny.
Example
warning RDK0008: analyzer assemblies are under a framework folder 'net8.0'
Roslyn loads analyzers from analyzers/dotnet/<language>/, optionally with a Roslyn version and
a locale, and never from a target framework folder. 'net8.0' looks like the lib/ layout applied
here by mistake, which means analyzers/net8.0/Contoso.Analyzers.dll will never be loaded.
Nothing reports this: the diagnostics simply never appear.Findings are grouped by the offending folder rather than listed per file, since the fix is one move, not twenty.