Skip to content

Conversation

@mattleibow
Copy link
Member

Description of Change

As a side-effect of improving the CLI options in #31849, the CLI forces the TFM to be the older one if you use older template options.

An example is that in net9.0, there is a --Empty option. In .NET 10 we switched to --empty. If you use the former, it forces the template to be .NET 9. This change adds a hidden --Empty that allows old things to work if you use it, but still only shows the new ones.

There are several options that are still going to have issues, but some are not meant to be used by a user and should have been hidden since the start. Also, this is more of a convenience sine you can always override the template by passing -f net10.0 if bad things happen.

The --Empty just is more common and has a higher chance of being used.

Any issues that arise in future can be solved the same way and hopefully in .NET 11 we can start removing the duplicates. since they are hidden.

Issues Fixed

Fixes #32197

Copilot AI review requested due to automatic review settings October 27, 2025 18:40
@mattleibow
Copy link
Member Author

/backport to release/10.0.1xx

@github-actions
Copy link
Contributor

Started backporting to release/10.0.1xx (link to workflow run)

Copy link
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 adds backward compatibility for the --Empty CLI option by duplicating it as a lowercase --empty parameter while hiding the original uppercase version. This prevents the .NET CLI from forcing users to an older template version when using the legacy --Empty flag, while maintaining the modern lowercase convention as the visible default.

Key changes:

  • Adds a new lowercase empty parameter alongside the existing Empty parameter in template configurations
  • Hides the uppercase Empty option in CLI host configuration files
  • Updates the SampleContent computed value to check both Empty and empty flags

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/Templates/src/templates/maui-blazor/.template.config/template.json Adds lowercase empty parameter and updates SampleContent logic to check both flags
src/Templates/src/templates/maui-blazor/.template.config/dotnetcli.host.json Hides the uppercase Empty option from CLI
src/Templates/src/templates/maui-blazor-solution/.template.config/template.json Adds lowercase empty parameter and updates SampleContent logic to check both flags
src/Templates/src/templates/maui-blazor-solution/.template.config/dotnetcli.host.json Hides the uppercase Empty option from CLI

@rmarinho rmarinho merged commit bb73c7c into net10.0 Oct 28, 2025
19 checks passed
@rmarinho rmarinho deleted the dev/empty branch October 28, 2025 10:45
@github-actions github-actions bot locked and limited conversation to collaborators Nov 28, 2025
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