Skip to content

chore: explicit usings on every TFM (no implicit/global usings in multi-TFM projects) - #656

Merged
Chris-Wolfgang merged 1 commit into
mainfrom
chore/explicit-usings
Sep 28, 2026
Merged

Chris-Wolfgang merged 1 commit into
mainfrom
chore/explicit-usings

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Why

Rule: a project that targets multiple TFMs must not use implicit or global usings; every file states its own using directives.

With <ImplicitUsings>enable</ImplicitUsings>, the net8.0+ slices get System, System.Linq, System.Threading.Tasks etc. globally. InspectCode analyses one modern TFM slice, so it flags usings that net462 / netstandard genuinely need as RedundantUsingDirective, which produced false-positive code-scanning alerts. With implicit usings off, each file's usings are required on every TFM.

Changes

Multi-TFM projects that had implicit/global usings (the src projects and the other multi-TFM test projects already had them off):

  • tests/Wolfgang.Etl.Abstractions.Tests.Unit/Wolfgang.Etl.Abstractions.Tests.Unit.csproj: ImplicitUsings set to disable, global <Using Include="Xunit" /> removed
  • tests/Wolfgang.Etl.ErrorPolicies.Tests.Unit/Wolfgang.Etl.ErrorPolicies.Tests.Unit.csproj: same

Explicit using directives added to the 55 .cs files in those projects (System-first order). A temporary IDE0005-as-warning build across all 11 TFMs (not committed) was used to drop any added using that was unnecessary on every TFM. Changelog fragment: internal.

No behaviour or public API change; no protected files touched.

Verified locally

  • dotnet build ETL-Abstractions.sln -c Release: 0 warnings, 0 errors
  • scripts/build-pr.ps1: all checks passed (13630/13630 test executions passed across TFMs, coverage gate passed)

🤖 Generated with Claude Code

…ti-TFM projects)

Disable ImplicitUsings and drop the global `<Using Include="Xunit" />` in the two
multi-target unit test projects (Abstractions.Tests.Unit, ErrorPolicies.Tests.Unit),
and add the explicit using directives each file needs. With implicit usings on, the
modern TFM slices got System/System.Linq/etc. globally, so single-slice analysis
(InspectCode) flagged the usings net462/netstandard need as redundant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant