Conversation
|
/backport to release/10.0.1xx |
|
Started backporting to |
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 |
|
Could we remove the duplicate for the net11 branch? We started hitting an issue due to the duplicate option dotnet/templating#10025. (Triggered by the migration to new json schema parsing https://github.com/dotnet/templating/com). cc: @mattleibow |
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