Conversation
Member
Author
|
/backport to release/10.0.1xx |
Contributor
|
Started backporting to |
Contributor
There was a problem hiding this comment.
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
emptyparameter alongside the existingEmptyparameter in template configurations - Hides the uppercase
Emptyoption in CLI host configuration files - Updates the
SampleContentcomputed value to check bothEmptyandemptyflags
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 |
src/Templates/src/templates/maui-blazor-solution/.template.config/template.json
Show resolved
Hide resolved
rmarinho
approved these changes
Oct 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
--Emptyoption. 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--Emptythat 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.0if bad things happen.The
--Emptyjust 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