Skip to content

Retarget the SDK to net12.0 - #9076

Closed
marcpopMSFT wants to merge 19 commits into
mainfrom
marcpopmsft-port-sdk-net12-retarget
Closed

marcpopMSFT wants to merge 19 commits into
mainfrom
marcpopmsft-port-sdk-net12-retarget

Conversation

@marcpopMSFT

Copy link
Copy Markdown
Member

🤖 Ports dotnet/sdk#56086 into the VMR's src/sdk subtree so the dotnet/dotnet test matrix can validate the same changes.

The port preserves the complete upstream patch: 38 files changed with 148 additions and 57 deletions. The only mechanical adjustment is retaining the VMR's existing property ordering in src/sdk/global.json while applying the same bootstrap SDK version update.

Port the changes from dotnet/sdk#56086 into the VMR SDK subtree so dotnet/dotnet CI can validate the same retargeting changes.

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

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
Copilot AI lite review requested due to automatic review settings September 4, 2026 23:15
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 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.

🟡 Changes recommended

NETCoreAppMaximumVersion formatting and the ToolsetInfo vs Product.TargetFrameworkVersion mismatch are concrete inconsistencies likely to break targeting/feature gating during the net12 transition.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Ports dotnet/sdk#56086 into the VMR src/sdk subtree to retarget the SDK/tooling to net12.0, while temporarily pinning some test assets to net11.0 until dependent workloads/assets are ready.

Changes:

  • Retarget core SDK tasks/tools/targets from net11.0 to net12.0 (and advance “next” TFM to net13.0 in test infrastructure).
  • Update CLI MSBuild forwarding + telemetry parent-context handling to better refresh/clear activity context between builds.
  • Add interim overrides/workarounds (prune package data / branding / asset TFMs) to keep builds/tests functioning during the transition.
File summaries
File Description
src/sdk/Directory.Build.props Forces net12 targeting and adds interim overrides (e.g., NETCoreAppMaximumVersion).
src/sdk/global.json Updates bootstrap SDK version used under src/sdk.
src/sdk/Directory.Packages.props Adds Microsoft.Extensions.Options package version entry.
src/sdk/documentation/general/UpdateToNewTargetFramework.md Documents extra feed steps needed during new-TFM bootstrap.
src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Common.targets Moves tasks TFM to net12.0 under Core MSBuild.
src/sdk/src/WebSdk/Publish/Targets/Microsoft.NET.Sdk.Publish.targets Moves publish task TFM to net12.0 under Core MSBuild.
src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ApiCompat.targets Points ApiCompat task assembly path at net12.0.
src/sdk/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/msbuildExtensions/Microsoft/Microsoft.NET.Build.Extensions/Microsoft.NET.Build.Extensions.targets Moves extensions task assembly path to net12.0.
src/sdk/src/StaticWebAssetsSdk/Targets/Sdk.StaticWebAssets.CurrentVersion.targets Updates Static Web Assets tasks/tool TFMs to net12.0.
src/sdk/src/RazorSdk/Targets/Sdk.Razor.CurrentVersion.targets Updates Razor tasks TFM to net12.0.
src/sdk/src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.5_0.targets Updates Blazor WASM tasks/tool TFMs to net12.0.
src/sdk/src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets Updates Blazor WASM tasks/tool TFMs to net12.0.
src/sdk/src/Containers/packaging/build/Microsoft.NET.Build.Containers.props Updates container task framework to net12.0.
src/sdk/src/Containers/Microsoft.NET.Build.Containers/PublicAPI/net12.0/PublicAPI.Shipped.txt Adds net12 PublicAPI baseline marker.
src/sdk/src/Containers/Microsoft.NET.Build.Containers/PublicAPI/net12.0/PublicAPI.Unshipped.txt Adds net12 PublicAPI surface to be reviewed/approved.
src/sdk/src/Cli/dotnet/Telemetry/TelemetryClient.cs Adds configurable precedence between runtime vs env activity context carriers.
src/sdk/src/Cli/dotnet/Commands/MSBuild/MSBuildLogger.cs Prefers env-provided parent activity context for MSBuild spans.
src/sdk/src/Cli/dotnet/Commands/MSBuild/MSBuildForwardingApp.cs Refreshes required env vars and clears stale trace context before execute.
src/sdk/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs Allows overwriting env-var entries (dictionary indexer) for refresh scenarios.
src/sdk/src/Cli/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs Allows updating env vars by key (dictionary indexer).
src/sdk/src/Cli/dotnet/dotnet.csproj Adds Microsoft.Extensions.Options dependency.
src/sdk/src/Cli/dotnet-aot/dotnet-aot.csproj Updates retargeting-related comment example to net12.0.
src/sdk/src/Layout/redist/targets/GenerateBundledVersions.targets Adds interim overrides for net12 branding/prune package data gaps.
src/sdk/src/Layout/redist/targets/Crossgen.targets Temporarily pins WindowsDesktop tools path to net11.0.
src/sdk/src/Layout/redist/tools/tool_fsc.csproj Temporarily pins F# tool TFM to net11.0.
src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.SupportedTargetFrameworks.props Adds net12.0 to supported framework defines.
src/sdk/test/Microsoft.NET.TestFramework/ToolsetInfo.cs Advances current/next TFMs to net12/net13.
src/sdk/test/Microsoft.NET.Sdk.Web.Tests/PublishTests.cs Updates TFM conditional compilation and adds NetTFMUpdate note.
src/sdk/test/Microsoft.NET.Publish.Tests/PublishTestUtils.cs Updates TFM conditional compilation and retains current-TFM lists.
src/sdk/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs Updates “higher-than-supported” framework test case to netcoreapp12.1.
src/sdk/test/dotnet.Tests/CommandTests/MSBuild/GivenMSBuildLogger.cs Adds regression coverage for clearing tracestate/runtime context interactions.
src/sdk/test/dotnet.Tests/CommandTests/MSBuild/GivenMsbuildForwardingApp.cs Adds tests for env-var refresh behavior and stale activity clearing.
src/sdk/test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmPublishIntegrationTest.cs Uses DefaultTfm for build output paths rather than toolset constant.
src/sdk/test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests.csproj Temporarily pins AspNetTestTfm to net11.0.
src/sdk/test/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj Temporarily pins AspNetTestTfm to net11.0.
src/sdk/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/Microsoft.NET.Sdk.StaticWebAssets.Tests.csproj Temporarily pins AspNetTestTfm to net11.0.
src/sdk/src/Microsoft.CodeAnalysis.NetAnalyzers/tests/Test.Utilities/Test.Utilities.csproj Adds temporary package references pending prune package data availability.
src/sdk/.github/memory/API_MAP.md Updates API map reference to the net12 container PublicAPI path.
Review details
  • Files reviewed: 36/38 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/sdk/Directory.Build.props Resolved
Port the latest fixes from dotnet/sdk#56086 and update the VMR root bootstrap SDK so component builds have net12 ASP.NET Core framework-reference metadata.

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

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
@marcpopMSFT
marcpopMSFT requested review from a team as code owners September 9, 2026 16:47
Add dotnet12 and dotnet12-transport to VMR and component NuGet configurations so repositories built by the net12 bootstrap SDK can resolve runtime, targeting, and tooling packages.

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

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
@dotnet-policy-service
dotnet-policy-service Bot requested review from a team September 9, 2026 20:39
Comment thread src/msbuild/NuGet.config Resolved
Propagate the runtime-produced Microsoft.NET.ILLink.Tasks version to repositories that consume live runtime during source-only builds.

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

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team September 10, 2026 00:28

@adamsitnik adamsitnik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

S.CL LGTM

Comment thread src/cecil/NuGet.config Resolved
Comment thread src/emsdk/NuGet.config Resolved
Comment thread src/scenario-tests/NuGet.config Resolved
Pass the VMR current TFM to SDK layout generation so source-only builds consume the content path produced by VSTest during framework rollovers.

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

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team September 10, 2026 16:12
Preserve an explicitly supplied Test CLI package content TFM before applying SDK source-build and normal-build defaults.

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

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
Use the previously-source-built ILLink pack until runtime produces the live pack, and disable F# ReadyToRun publication before runtime is available.

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

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team September 11, 2026 19:17
marcpopMSFT and others added 6 commits September 11, 2026 15:08
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
Share apphost packaging between separate target and portable projects so NuGet static graph restore retains both assets files. Only produce the portable alias when the SDK RID matches the portable target RID, avoiding mislabeled cross-architecture binaries.

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

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
Include NetMinimum alongside SdkTargetFramework in source-only packages while the SDK targets a newer framework than Arcade. Stage 2 can then consume the stage-1 package without NU1202, while retaining the SDK's net12.0 asset and leaving normal builds unchanged.

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

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
@JulieLeeMSFT

Copy link
Copy Markdown
Member

Ping @dotnet/dotnet-cli and @dotnet/dnr-codeflow for build failure. PTAL protected global.json edits and net11/net12 package/assets incompatibility.

@JulieLeeMSFT

JulieLeeMSFT commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

@dotnet/msbuild, premature MSBuild child-node exit (MSB4166). Need to verify which, if either, matches the missing failure stack and track the applicable open fix.
https://dev.azure.com/dnceng-public/public/_build/results?buildId=1596637&view=results

Comment thread repo-projects/Directory.Build.targets Resolved
<_HostArtifact Include="$(ArtifactsPackagesDir)**\Microsoft.NETCore.App.Crossgen2.*.nupkg"
Exclude="$(ArtifactsPackagesDir)**\Microsoft.NETCore.App.Crossgen2.$(TargetRid).*.nupkg" />

<_HostArtifact Include="$(ArtifactsPackagesDir)**\Microsoft.NETCore.App.Host.*.nupkg"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@akoeplinger or someone else from runtime should look at these runtime changes

Comment thread src/sdk/global.json Resolved
</GetKnownArtifactsFromAssetManifests>

<!-- Use approved bootstrap packs until runtime's live packs are available to the repository being built. -->
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@mthalman to review this workaround copilot applied to fix the source build legs

Comment thread src/deployment-tools/NuGet.config Resolved
Comment thread src/command-line-api/NuGet.config Resolved
Comment thread src/sourcelink/NuGet.config Resolved
Comment thread src/symreader/NuGet.config Resolved
Comment thread NuGet.config Resolved
Port the upstream HelpBuilder root HelpName fix and remove unneeded dotnet12 transport feeds from the root, deployment-tools, command-line-api, sourcelink, and symreader configurations.

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

Copilot-Session: a76caf7b-a621-4acd-9c5c-42b84d70181c
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team September 15, 2026 23:07

@ViktorHofer ViktorHofer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@jkoritzinsky PTAL at the runtime changes in particular

Comment thread global.json
{
"sdk": {
"version": "11.0.100-rc.1.26420.103",
"version": "12.0.100-alpha.1.26458.102",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm a bit unsure about the intent of this PR. Why do we need to retarget the SDK in the VMR to 12.0?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🤖 The intent is to validate the SDK retargeting from dotnet/sdk#56086 against the VMR test matrix. The root global.json change selects the bootstrap SDK used to build the sources; it does not retarget every VMR component to net12.0.

The VMR's UpdateGlobalJsonVersions rewrites each constituent repo's sdk.version and tools.dotnet to the VMR's $(NETCoreSdkVersion), and the builds share that dotnet installation. Updating only src/sdk/global.json therefore still left the retargeted SDK sources building with the root's .NET 11 bootstrap. The initial CI run failed with NETSDK1073 because that bootstrap lacked the required net12 ASP.NET Core framework-reference metadata.

Updating the root to the same .NET 12 bootstrap as the upstream SDK PR fixed that mismatch. It does mean the other repos also build using the newer SDK while retaining their existing target frameworks, which exposed the source-build pack-selection issues addressed here. Keeping the root on .NET 11 would require a separate bootstrap-selection path for src/sdk, rather than just changing its own global.json.

Note

Auto-replied by the GitHub Copilot app.

@ViktorHofer ViktorHofer Sep 16, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@marcpopMSFT please a human response :) Why does dotnet/sdk (which from the above reading triggers this VMR SDK upgrade) need to update the SDK to 12.0 already? Infrastructure to target a newer TFM already exists and is automatically enabled by the Arcade SDK.

Asking as we wrote it down as a principle last time to be able to do the TFM work without needing to upgrade the SDK.

@marcpopMSFT marcpopMSFT Sep 16, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You commented on the root global.json so I thought you were asking about that specific change. What you actually mean is that I should not update the stage0 SDK of the src\sdk when retargeting.

I admit that I don't recall that being a principal of the retro from last time. The SDK has always updated known framework references first, then updated global.json, and then retargeted. That process works great in the SDK repo for years. Are you saying that using the arcade method is preferred or just that it's possible? What does doing that way get us? Does it avoid some of these workarounds?

If it's just to make it so I don't have to update global.json, I guess that's fine though I have a better understanding of how the sdk targets work than the arcade ones. If it simplifies the update, I want to understand how.

@ViktorHofer ViktorHofer Sep 17, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's the Arcade supporting infrastructure: https://github.com/dotnet/arcade/blob/5b2519b1ceeb6df955426acf7727a1a9acbf082c/src/Microsoft.DotNet.Arcade.Sdk/tools/TargetingPacks.BeforeCommonTargets.targets#L53-L99

It's quite simple. It just copies the items from the latest supported TFM in the SDK and updates the TFM to the new desired value. You can make that so that it happens automatically by setting NetCurrent to the new value. If that isn't always possible or not desired at this point you can set these two properties instead: TargetingPackBaselineTargetFramework and TargetingPackCurrentTargetFramework

Choose how you want to proceed, I don't have a strong objection but that Arcade infra was explicitly added for these yearly activities.

@marcpopMSFT

marcpopMSFT commented Sep 22, 2026 •

Copy link
Copy Markdown
Member Author

closed in favor of #9503

@akoeplinger
akoeplinger deleted the marcpopmsft-port-sdk-net12-retarget branch October 27, 2026 14:50
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.

9 participants