Skip to content

Use wildcard versions for template dependencies in preview builds#34214

Merged
mattleibow merged 1 commit into
net11.0from
feature/template-wildcard-versions-preview
Mar 2, 2026
Merged

Use wildcard versions for template dependencies in preview builds#34214
mattleibow merged 1 commit into
net11.0from
feature/template-wildcard-versions-preview

Conversation

@mattleibow
Copy link
Copy Markdown
Member

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description

When StabilizePackageVersion is false (preview/non-release builds), the template version values for external ASP.NET Core and Extensions packages included specific build numbers (e.g., 11.0.0-preview.2.26103.111). This meant template-generated projects were pinned to an exact build number during preview.

This PR strips the build number and replaces it with a wildcard (*) so that templates use floating versions during preview (e.g., 11.0.0-preview.2.*). When StabilizePackageVersion is true (stable/release builds), the exact version is used as before.

Affected version placeholders

  • MS_EXT_LOG_DEBUG_VERSION_VALUE
  • MS_COMPONENTS_WEB_VERSION_VALUE
  • MS_COMPONENTS_WEBASSEMBLY_VERSION_VALUE
  • MS_COMPONENTS_WEBASSEMBLY_SERVER_VERSION_VALUE

How it works

Added conditional PropertyGroup entries inside the _UpdateTemplateVersions target that use Regex.Replace to transform versions like 11.0.0-preview.2.26103.11111.0.0-preview.2.*. The regex (-[a-zA-Z][a-zA-Z0-9]*\.\d+)\.\d+\.\d+ matches the prerelease label and iteration, then strips the trailing build number segments. Stable versions (no prerelease label) are unaffected since the regex does not match.

Copilot AI review requested due to automatic review settings February 24, 2026 16:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 modifies the template packaging process to use wildcard versions for external ASP.NET Core and Extensions package dependencies during preview builds. When StabilizePackageVersion is false (preview/non-release builds), version strings like 11.0.0-preview.2.26103.111 are transformed to 11.0.0-preview.2.* using regex replacement. This allows template-generated projects to automatically receive the latest compatible preview builds rather than being pinned to a specific build number. During stable builds (StabilizePackageVersion is true), exact versions are used as before.

Changes:

  • Added conditional property groups in _UpdateTemplateVersions target to transform four external package version properties using regex when in preview mode
  • Modified ReplaceFileText task to use the transformed version properties instead of the original ones
  • Versions are transformed from X.Y.Z-label.N.BUILD.REVISION format to X.Y.Z-label.N.* format

@mattleibow mattleibow force-pushed the feature/template-wildcard-versions-preview branch 2 times, most recently from 52aebd7 to 220ad2c Compare February 24, 2026 17:56
@mattleibow mattleibow added this to the .NET 11.0-preview2 milestone Feb 24, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Copy link
Copy Markdown
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

This looks good to me; we'll want to backport to release/11.0.1xx-preview2 after it's green and merged.

@mattleibow
Copy link
Copy Markdown
Member Author

/azp run maui-pr-devicetests

@mattleibow
Copy link
Copy Markdown
Member Author

/azp run maui-pr-uitests

@mattleibow mattleibow closed this Feb 24, 2026
@azure-pipelines
Copy link
Copy Markdown

Pull request is closed

@mattleibow mattleibow reopened this Feb 24, 2026
@mattleibow
Copy link
Copy Markdown
Member Author

/azp run maui-pr-devicetests

@mattleibow
Copy link
Copy Markdown
Member Author

/azp run maui-pr-uitests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

1 similar comment
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@mattleibow
Copy link
Copy Markdown
Member Author

/rebase

When StabilizePackageVersion is false, strip the build number from
external dependency versions used in templates and replace with a
wildcard. For example, 11.0.0-preview.2.26103.111 becomes
11.0.0-preview.2.* so template-generated projects don't pin to a
specific build number during preview.

Affects: MS_EXT_LOG_DEBUG_VERSION_VALUE, MS_COMPONENTS_WEB_VERSION_VALUE,
MS_COMPONENTS_WEBASSEMBLY_VERSION_VALUE,
MS_COMPONENTS_WEBASSEMBLY_SERVER_VERSION_VALUE

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow
Copy link
Copy Markdown
Member Author

/backport to release/11.0.1xx-preview2

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 2, 2026

Started backporting to release/11.0.1xx-preview2 (link to workflow run)

@mattleibow mattleibow merged commit 178eb48 into net11.0 Mar 2, 2026
23 of 27 checks passed
@mattleibow mattleibow deleted the feature/template-wildcard-versions-preview branch March 2, 2026 22:34
mattleibow added a commit that referenced this pull request Mar 2, 2026
…encies in preview builds (#34305)

Backport of #34214 to release/11.0.1xx-preview2

/cc @mattleibow

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants