Skip to content

Retarget SDK sources to net12.0 without updating stage zero - #56348

Closed
marcpopMSFT wants to merge 4 commits into
mainfrom
marcpopmsft-net12-sdk-retargeting
Closed

marcpopMSFT wants to merge 4 commits into
mainfrom
marcpopmsft-net12-sdk-retargeting

Conversation

@marcpopMSFT

@marcpopMSFT marcpopMSFT commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

🤖 Separates source retargeting from the stage-0 SDK update, following Viktor's suggestion. This keeps the net12 transition smaller while leaving both SDK version entries in global.json unchanged.

Approach

  • Set the SDK source TFM to net12.0 and use Arcade's explicit net11.0 targeting-pack baseline. The reference APIs and execution runtime remain on .NET 11 during this phase.
  • Move SDK task/tool lookup paths and container API baselines to net12.0. Keep externally produced F# and WindowsDesktop tool paths on their actual packaged TFM, and preserve ApiCompat's lower compilation target.
  • Separate the compiled SDK TFM from test-app defaults. Product branding, runtime dependencies, and template defaults are unchanged.
  • Add task-layout regression coverage and document the source-only rollover phase.

Temporary bootstrap accommodations

The pinned Arcade does not synthesize ASP.NET Core framework references, so a conditional baseline copy fills that gap. The older SDK also lacks net12 package-pruning data; LoadPrunePackageDataFromNearestFramework uses the baseline framework's data. Live Core and ASP.NET reference-pack overrides also recognize the explicit baseline version so net12 sources resolve against the flowed net11 packs, not the older stage-0 packs. These accommodations are scoped to the new source TFM, including platform-qualified variants, and the older bootstrap, and are documented for cleanup during the bootstrap transition.

CI follow-up fixes

  • Resolve watch tools using the SDK source TFM, and prevent a duplicate framework-provided DI abstractions assembly in the SDK layout. Aligning live reference packs fixes the telemetry logger's split assembly-identity failure.
  • Build the verbosity test asset separately, then run dotnet test --no-build -v ..., so build output cannot split the VSTest result lines being asserted.
  • Replace the multi-TFM test asset's process-module enumeration with active-run markers isolated to each test copy. This avoids the Windows Win32Exception (299) while preserving parallel-versus-sequential assertions. Update both consumers of the asset.
  • Retry localization cleanup with the existing bounded IOException retry helper; persistent failures still propagate. The directory-lock failure also occurs on main ([AI discovered CI] LocalizeTemplateTests.CanRunTask fails cleaning locked directory #56222; related proposal Retry transient directory cleanup in LocalizeTemplateTests #56223). Its handle owner remains unidentified. Explicitly select the SDK under test for localization commands to avoid bootstrap/redist mixing during local runs.

Validation

  • Full Debug SDK build succeeded using the unchanged pinned stage-0 SDK, 11.0.100-rc.1.26420.103; a fresh redist rebuild also succeeded after pack-alignment changes.
  • Initial focused task-layout/library, Razor build, and Static Web Assets build/publish runs: 132 passed, 5 skipped.
  • First CI corrections: 9 layout cases, 2 watch cases, 1 server telemetry case, and all 5 telemetry host-matrix cases passed. The local Aspire matrix required a shorter test-only tool path.
  • Latest test-harness corrections: 11 cases run three times each, totaling 33 passes. The previously disabled diag verbosity row remained skipped in each run. These cover verbosity, both multi-TFM modes, the binary-log asset consumer, and all four localization cases.
  • The built CLI starts with a net12.0 runtimeconfig TFM and a .NET 11 runtime requirement.

The build reports four NU1903 warnings for existing System.Formats.Asn1 5.0.0 analyzer-test dependencies; no package changes or warning suppressions are included. Full-suite, source-only build mode, and cross-architecture validation were not run locally. CI must validate the latest commit.

Use Arcade net11 targeting-pack metadata as the net12 baseline, update task layouts and API baselines, and keep product defaults and external tool TFMs unchanged. Add scoped bootstrap compatibility settings and layout regression coverage, and document the split rollover.

Co-authored-by: Copilot App <[email protected]>
Copilot AI lite review requested due to automatic review settings September 17, 2026 21:47
@marcpopMSFT
marcpopMSFT requested review from a team, lbussell and mthalman as code owners September 17, 2026 21:47
@marcpopMSFT
marcpopMSFT requested a review from a team September 17, 2026 21:47
@marcpopMSFT
marcpopMSFT requested a review from a team as a code owner September 17, 2026 21:47
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It changes repo-wide TFMs and multiple MSBuild task/tool resolution paths with broad blast radius, so it needs human validation beyond the targeted regressions included here.

Pull request overview

Retargets the SDK’s build outputs and tool/task lookup paths to net12.0 while keeping the pinned stage-0 SDK and product packs on .NET 11, including temporary bootstrap workarounds and regression coverage to validate the updated layout.

Changes:

  • Retarget SDK source/build TFMs to net12.0 while using Arcade’s net11.0 targeting-pack baseline and adding temporary bootstrap accommodations (prune data + ASP.NET Core KnownFrameworkReference baseline copy).
  • Update MSBuild targets/props that resolve SDK task/tool assemblies (Build.Tasks, Razor/SWA/Blazor tools, Publish, ApiCompat, Containers) to look under net12.0 folders; pin select external package paths to net11.0 where producers haven’t retargeted yet.
  • Update tests and contributor documentation for the “source-only retarget” phase; add task-layout regression tests and introduce ToolsetInfo.SdkTargetFramework.
File summaries
File Description
test/Microsoft.NET.TestFramework/ToolsetInfo.cs Introduces SdkTargetFramework constant (net12.0) to distinguish compiled SDK TFM from generated-app defaults.
test/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs Updates compile-time TFM guard from NET11_0 to NET12_0.
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/Microsoft.NET.Sdk.StaticWebAssets.Tests.csproj Pins ASP.NET test-app metadata TFM to net11.0.
test/Microsoft.NET.Sdk.Razor.Tests/Microsoft.NET.Sdk.Razor.Tests.csproj Pins ASP.NET test-app metadata TFM to net11.0.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests.csproj Pins ASP.NET test-app metadata TFM to net11.0.
test/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj Pins ASP.NET test-app metadata TFM to net11.0.
test/Microsoft.NET.Publish.Tests/PublishTestUtils.cs Updates compile-time TFM guard from NET11_0 to NET12_0.
test/Microsoft.NET.Build.Tests/GivenTheSdkTaskLayout.cs Adds regression test asserting SDK task assemblies are deployed under ToolsetInfo.SdkTargetFramework and validates ApiCompat deployment.
test/Microsoft.NET.Build.Containers.IntegrationTests/PackageTests.cs Updates containers package content test to validate net12.0 task folder layout.
src/WebSdk/Publish/Targets/Microsoft.NET.Sdk.Publish.targets Switches publish task lookup to net12.0 under Core MSBuild.
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Common.targets Switches core tasks directory TFM from net11.0 to net12.0.
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ApiCompat.targets Updates ApiCompat task path to net12.0.
src/Tasks/Microsoft.NET.Build.Extensions.Tasks/msbuildExtensions/Microsoft/Microsoft.NET.Build.Extensions/Microsoft.NET.Build.Extensions.targets Updates extensions task path to net12.0 for Core MSBuild.
src/StaticWebAssetsSdk/Targets/Sdk.StaticWebAssets.CurrentVersion.targets Updates Static Web Assets tasks/tool lookup paths to net12.0.
src/RazorSdk/Targets/Sdk.Razor.CurrentVersion.targets Updates Razor tasks lookup path to net12.0.
src/Layout/redist/tools/tool_fsc.csproj Temporarily pins F# tool layout TFM to net11.0 pending upstream retarget.
src/Layout/redist/targets/Crossgen.targets Temporarily pins WindowsDesktop tool layout path to net11.0 pending upstream retarget.
src/Containers/packaging/build/Microsoft.NET.Build.Containers.props Updates container task folder TFM to net12.0.
src/Containers/Microsoft.NET.Build.Containers/PublicAPI/net12.0/PublicAPI.Unshipped.txt Adds new net12 public API baseline file for Containers.
src/Containers/Microsoft.NET.Build.Containers/PublicAPI/net12.0/PublicAPI.Shipped.txt Adds new net12 shipped baseline placeholder for Containers.
src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets Updates Blazor WASM tasks/tool lookup paths to net12.0.
src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.5_0.targets Updates Blazor WASM tasks/tool lookup paths to net12.0.
documentation/general/UpdateToNewTargetFramework.md Documents the new “retarget sources independently of bootstrap SDK” step and temporary accommodations.
Directory.Build.targets Adds conditional AllowMissingPrunePackageData and an ASP.NET Core KnownFrameworkReference baseline copy for stage-0 builds.
Directory.Build.props Sets NetCurrent to net12.0 and configures explicit targeting-pack baseline/current TFMs plus NETCoreAppMaximumVersion.
.github/memory/API_MAP.md Updates API-map doc link to the containers net12 baseline.
Review details
  • Files reviewed: 24/26 changed files
  • Comments generated: 5
  • Review effort level: Lite

Comment thread .github/memory/API_MAP.md Resolved
Use live baseline framework packs and nearest-framework pruning data while keeping stage zero unchanged. Resolve watch test tasks from the SDK source TFM and guard against duplicate framework DI assemblies in the SDK layout.

Co-authored-by: Copilot App <[email protected]>
@marcpopMSFT
marcpopMSFT requested a review from a team as a code owner September 18, 2026 17:13
Isolate VSTest console output from build logging and replace cross-process module inspection with per-test active-run markers. Retry localization directory cleanup with the existing bounded helper and explicitly use the SDK under test.

Co-authored-by: Copilot App <[email protected]>
@marcpopMSFT
marcpopMSFT requested review from a team as code owners September 18, 2026 19:09
marcpopMSFT added a commit to dotnet/dotnet that referenced this pull request Sep 21, 2026
Port dotnet/sdk#56348 follow-ups through 006c74304ad: align live baseline packs and pruning data, fix watch lookup, stabilize CLI and localization tests, and clarify container API documentation. Preserve VMR source-only pack overrides and bootstrap compatibility fixes.

Co-authored-by: Copilot App <[email protected]>
@marcpopMSFT

Copy link
Copy Markdown
Member Author

closed in favor of dotnet/dotnet#9076

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.

2 participants