Skip to content

Never stabilize Components.Media and Components.Testing packages - #68061

Merged
javiercn merged 1 commit into
mainfrom
javiercn/preview-only-media-testing-packages
Jul 29, 2026
Merged

javiercn merged 1 commit into
mainfrom
javiercn/preview-only-media-testing-packages

Conversation

@javiercn

Copy link
Copy Markdown
Member

Overview

Microsoft.AspNetCore.Components.Media and Microsoft.AspNetCore.Components.Testing are not shipping a stable version as part of .NET 11.0, so they must never produce an 11.0.0 (RTM) or 11.0.0-rc.N (branded RC) package, even when the release branch does a stabilized build. This change opts both packages out of version stabilization in Arcade so they keep producing dated prerelease versions like 11.0.0-preview.7.26378.1 in every build kind. Three files change: eng/Versions.props plus the two src project files. No product code changes, and VersionPrefix is untouched, so assembly and file versions stay 11.0.0.0.

Design

The contract is a pair of new repo-level properties in eng/Versions.props that own the label used by packages that intentionally never stabilize, so the label does not drift when the release branch flips PreReleaseVersionLabel to rc or rtm:

<!-- eng/Versions.props -->
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
<!-- Allowed values: '', 'prerelease', 'release'. Set to 'release' when stabilizing. -->
<DotNetFinalVersionKind></DotNetFinalVersionKind>
<!--
  Label and iteration used by packages that intentionally never stabilize. Such projects set
  SuppressFinalPackageVersion=true and override PreReleaseVersionLabel/PreReleaseVersionIteration with these
  values, so they keep producing dated prerelease versions (e.g. 11.0.0-preview.7.25580.1) even when the rest of
  the repo builds RC or RTM versions. Overriding the label is required because Arcade builds the version suffix
  from PreReleaseVersionLabel, and because the suffix logic is skipped entirely when that label is empty.
-->
<PreviewOnlyPackagePreReleaseVersionLabel>preview</PreviewOnlyPackagePreReleaseVersionLabel>
<PreviewOnlyPackagePreReleaseVersionIteration>7</PreviewOnlyPackagePreReleaseVersionIteration>

Two design decisions are worth calling out, because the obvious simpler versions of this change do not work.

SuppressFinalPackageVersion alone is not enough. Arcade's escape hatch restores the dated suffix, but that suffix is built from PreReleaseVersionLabel, which the release branch sets to rtm at GA. Without the label override the package version becomes 11.0.0-rtm.7.26378.1, which is prerelease but reads like an RTM build. Worse, if the branch ever sets PreReleaseVersionLabel to empty (Arcade's release-only path), the entire suffix block is skipped, SuppressFinalPackageVersion is never consulted, and the version collapses to 11.0.737801. Pinning a non-empty label defends against both.

The properties must live in the project body, not in Directory.Build.targets. Arcade computes the version in Version.BeforeCommonTargets.targets, which is imported after the project body but before Directory.Build.targets, so anything set in the repo's targets file is too late to be observed.

Implementation

Both projects get the same three properties. Media is the representative case:

<!-- src/Components/Media/src/Microsoft.AspNetCore.Components.Media.csproj -->
<!-- TreatAsLocalProperty lets the values below override the same properties when they arrive as MSBuild
     global properties, which is exactly how the official build passes the label (/p:PreReleaseVersionLabel=rtm).
     Without it, a global property wins over the project-level assignment and the RTM build produced
     11.0.0-rtm.7.26378.1 instead of 11.0.0-preview.7.26378.1. -->
<Project Sdk="Microsoft.NET.Sdk" TreatAsLocalProperty="PreReleaseVersionLabel;PreReleaseVersionIteration">

  <PropertyGroup>
    <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
    <Description>Media components for Blazor applications, including Image, Video, and FileDownload.</Description>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    <Nullable>enable</Nullable>
    <!--
      This package does not ship a stable version as part of .NET 11.0. Keep producing dated prerelease versions even
      when the repo builds RC or RTM versions. The label/iteration overrides are required so the version reads
      sensibly (and so Arcade's version suffix logic keeps running) once the branch moves to 'rc' or 'rtm'; they are
      listed in TreatAsLocalProperty above so they win even if the label is passed in as a global property.
    -->
    <SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
    <PreReleaseVersionLabel>$(PreviewOnlyPackagePreReleaseVersionLabel)</PreReleaseVersionLabel>
    <PreReleaseVersionIteration>$(PreviewOnlyPackagePreReleaseVersionIteration)</PreReleaseVersionIteration>
    <IsTrimmable>true</IsTrimmable>
  </PropertyGroup>

src/Components/Testing/src/Microsoft.AspNetCore.Components.Testing.csproj takes the identical TreatAsLocalProperty attribute and the identical three-property block; nothing else differs between the two, so it is not repeated here. The Testing package also packs Testing/gen and Testing/tasks as content, but both of those already set IsPackable=false, so only the two packages above are affected.

This is safe to do per-project because neither package is part of the shared framework. Neither appears in eng/SharedFramework.Local.props, they are listed only in eng/ShippingAssemblies.props, eng/ProjectReferences.props and eng/TrimmableProjects.props, and nothing in the repo takes a versioned dependency on them, so decoupling their package version from the product version has no ripple effect. eng/Publishing.props does not filter packages by version either, so a prerelease-versioned shipping package still gets signed and published normally.

Outcome

Verified by MSBuild property evaluation against Microsoft.AspNetCore.Components.QuickGrid as an unmodified control, using -p:OfficialBuildId=20260728.1:

Scenario Media / Testing QuickGrid (control)
RTM (DotNetFinalVersionKind=release, label rtm) 11.0.0-preview.7.26378.1 11.0.0
RC1 (DotNetFinalVersionKind=prerelease, label rc, iteration 1) 11.0.0-preview.7.26378.1 11.0.0-rc.1.final
Daily official build 11.0.0-preview.7.26378.1 11.0.0-preview.7.26378.1
Empty PreReleaseVersionLabel (Arcade's release-only path) 11.0.0-preview.7.26378.1 11.0.737801
Local dev build (no OfficialBuildId) 11.0.0-dev 11.0.0-dev

A real -t:Pack of the Media project under the RTM simulation produced Microsoft.AspNetCore.Components.Media.11.0.0-preview.7.26378.1.nupkg while Microsoft.AspNetCore.App.Internal.Assets.11.0.0.nupkg packed stable in the same run, confirming the opt-out is scoped to the intended project. Packing the Testing project end to end was not possible locally because it transitively builds ANCM, which requires full MSBuild.exe; its version was confirmed through evaluation instead.

Two related decisions are deliberately left out of this change and still need a call: whether these packages keep IsShippingPackage=true and get published to nuget.org at GA, and whether their APIs stay in PublicAPI.Unshipped.txt through the RTM shipped-API sweep so we do not take stable-API compat obligations on packages that never shipped stable.

These two packages are not shipping a stable version as part of .NET 11.0,
so they must not produce an 11.0.0 (RTM) or 11.0.0-rc.N (branded RC) package
when the repo does a stabilized build.

Set SuppressFinalPackageVersion=true on both projects so Arcade keeps the
dated prerelease suffix, and pin PreReleaseVersionLabel/Iteration to new
PreviewOnlyPackage* properties in eng/Versions.props. Pinning the label is
required for two reasons: Arcade builds the version suffix from that label
(so RTM would otherwise yield 11.0.0-rtm.N.<date>.<rev>), and it skips the
suffix logic entirely when the label is empty. The properties are listed in
TreatAsLocalProperty so they also win over command-line global properties.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: b6b0bbb5-1c56-452c-95ce-03ec29c9d610
Copilot AI review requested due to automatic review settings July 28, 2026 11:14
@javiercn
javiercn requested review from a team and wtgodbe as code owners July 28, 2026 11:14

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.

Pull request overview

This PR ensures Microsoft.AspNetCore.Components.Media and Microsoft.AspNetCore.Components.Testing never produce stabilized (RC/RTM) package versions on .NET 11 release branches by opting them out of Arcade version stabilization while keeping assembly/file versions unchanged.

Changes:

  • Adds repo-level “preview-only package” version label/iteration properties in eng/Versions.props.
  • Updates the Media and Testing .csproj files to:
    • set SuppressFinalPackageVersion=true
    • override PreReleaseVersionLabel / PreReleaseVersionIteration to the new preview-only properties
    • use TreatAsLocalProperty so project values win over official-build global properties.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
eng/Versions.props Introduces shared properties for packages that must remain preview-only across RC/RTM builds.
src/Components/Media/src/Microsoft.AspNetCore.Components.Media.csproj Opts the Media package out of stabilization and pins prerelease label/iteration via repo-level properties.
src/Components/Testing/src/Microsoft.AspNetCore.Components.Testing.csproj Applies the same stabilization opt-out + label/iteration override behavior for the Testing package.

<Description>Media components for Blazor applications, including Image, Video, and FileDownload.</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>
<!--

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.

In the past, e.g, for Swagger.Grpc package, we used to only simply have:

    <VersionPrefix>$(ExperimentalVersionPrefix)</VersionPrefix>

Do we need the additional complication here over just setting VersionPrefix?

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.

Note that for Swagger.Grpc, the produced experimental versions didn't have any pre-release labels, but the version number itself was 0.x.y and that's how we indicated it being experimental. That probably arguably wasn't ideal from SemVer point of view though

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.

We want to keep the current version. We will remove this commit altogether once we branch for 12.0

@wtgodbe wtgodbe 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.

What's the motivation here? rc1 and rc2 shipping packages normally still get non-stable versions - we only go stable once we hit RTM. Will these still go to nuget? Having non-stable versioned packages on nuget would cause problems for any stable package who depends on them. Why not just mark them as non-shipping?

Comment thread eng/Versions.props Resolved

@wtgodbe wtgodbe 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.

Works for me

@javiercn
javiercn merged commit 96c2298 into main Jul 29, 2026
29 checks passed
@javiercn
javiercn deleted the javiercn/preview-only-media-testing-packages branch July 29, 2026 18:51
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 30, 2026
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.

4 participants