Skip to content

dotnet-svcutil: support WCF 10.* and make TFM->package mapping forward-compatible#5954

Open
imcarolwang wants to merge 1 commit into
dotnet:mainfrom
imcarolwang:dotnetSvcutil-wcfPkg
Open

dotnet-svcutil: support WCF 10.* and make TFM->package mapping forward-compatible#5954
imcarolwang wants to merge 1 commit into
dotnet:mainfrom
imcarolwang:dotnetSvcutil-wcfPkg

Conversation

@imcarolwang
Copy link
Copy Markdown
Contributor

@imcarolwang imcarolwang commented May 27, 2026

Problem

TargetFrameworkHelper.GetWcfProjectReferences (used by dotnet-svcutil to add <PackageReference> entries to a user project after generating WCF proxy code) had two issues:

  1. No WCF 10.* support. The "Current" bucket pinned WCF packages to 8.* for every TFM in s_currentSupportedVersions = { "8.0", "9.0", "10.0" }, so a project targeting net10.0 still got the 8.* packages.

  2. Forward-compatibility regression waiting to happen. Selection used a closed-list Contains(...) check. As soon as the SDK bumps to net11.0+, the lookup misses → the tool silently falls through to the Legacy 4.10.* bucket (5 packages instead of 3), which would mass-break test baselines (FixupUtil.cs normalizes package versions but not the number/set of packages).

Changes

src/dotnet-svcutil/lib/src/Shared/TargetFrameworkHelper.cs

  • Add a Net10 bucket pinned to WCF 10.* (System.ServiceModel.Http, NetTcp, Primitives).

  • Rename the existing Current bucket → Net8 for clarity (same 3 packages at 8.*).

  • Replace the closed-list membership check with a >= threshold so future .NET versions automatically pick the highest available bucket:

    Project's lowest DNX TFM Bucket Packages
    >= net10.0 (incl. future net11+) Net10 Http / NetTcp / Primitives @ 10.*
    net8.0 / net9.0 Net8 Http / NetTcp / Primitives @ 8.*
    anything older / netstandard-only / mixed with older DNX Legacy Duplex / Http / NetTcp / Security / Federation @ 4.10.*
    no DNX TFM (e.g. net462 only) unchanged System.ServiceModel assembly reference
  • Remove the now-unused s_currentSupportedVersions list. Both remaining callers (IsEndofLifeFramework, MSBuildProj.ParseAsync default-TFM fallback) only used .First(), so it collapses to a single internal const string MinSupportedDotNetVersion = "8.0".

src/dotnet-svcutil/lib/src/Shared/MSBuildProj.cs

  • Update the default-TFM fallback to use MinSupportedDotNetVersion.

Behavior preservation

  • net8.0, net9.0, net10.0 projects all still emit the same 3-package set, so existing baselines remain valid (FixupUtil.cs:51 normalizes versions per-line).
  • netstandard2.0-only, net6.0, net48, net462;netstandard2.0 continue to hit the Legacy bucket as before.
  • net462-only continues to receive the full-framework System.ServiceModel assembly reference (early return path, untouched).
  • IsEndofLifeFramework semantics unchanged (boundary is still 8.0).

Forward-compat win

When arcade bumps the SDK to net11.0+, the new logic picks the Net10 bucket (3 packages) instead of dropping into the Legacy 5-package set — no baseline churn required at that point.

@imcarolwang imcarolwang marked this pull request as ready for review May 29, 2026 07:42
…d-compatible

GetWcfProjectReferences picked a fixed-list `Current` bucket (8.*) for any TFM in {8.0, 9.0, 10.0} and fell through to the Legacy 4.10.* bucket for anything else. This meant: (a) projects targeting net10.0 still got WCF 8.* (netstandard2.0 fallback asset instead of the native net10.0 asset), and (b) once the arcade SDK bumps to net11.0+, every baseline test would silently switch to the 5-package Legacy set.

Changes in TargetFrameworkHelper.cs:

- Add a `Net10` bucket pinned to WCF 10.* (Http/NetTcp/Primitives).

- Rename `Current` -> `Net8` for clarity (unchanged content, 8.*).

- Replace the closed-list `s_currentSupportedVersions.Contains(...)` selection with a >= threshold: net10.0+ -> Net10, net8.0/net9.0 -> Net8, otherwise Legacy. Future .NET versions automatically pick the highest available bucket.

- Remove the now-unused `s_currentSupportedVersions` list. Both remaining callers (IsEndofLifeFramework, MSBuildProj.ParseAsync default-TFM fallback) only used `.First()`, so replace with a single `MinSupportedDotNetVersion` const (`8.0`).

MSBuildProj.cs: update the fallback to use the new constant.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@imcarolwang imcarolwang force-pushed the dotnetSvcutil-wcfPkg branch from 42835bd to 9fc56d4 Compare May 29, 2026 08:29
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