Allow to pick up certain template group or certain template to be run in case of ambiguity
See original GitHub issueAt the moment 2 cases for ambiguity may happen during template instantiation:
- different template groups may have same short name
- different templates in one group may have same precedence and it is not possible to determine the one to be run
Those cases may be solved by uninstalling one of the packages in template groups are coming from different packages, however if they are coming from single one the situation cannot be resolved.
Suggesting the following options to resolve these conflicts:
--group
allows to specify group identity to run--identity
allows to specify template identity to run
The error cases should be modified as following:
(ambiguous group)
Unable to resolve the template, these templates matched your input:
Name | Short name | Group |
---|---|---|
Template 1 | short | Group.Identity1 |
Template 2 | short | Group.Identity2 |
To run specific template, specify its group using --group option.
dotnet new short --group Group.Identity1.
(ambiguous template)
Unable to resolve the template, these templates matched your input:
Name | Short name | Identity |
---|---|---|
Template 1 | short | Templ.Identity1 |
Template 2 | short | Templ.Identity2 |
This may happen due to authoring error or ambiguous parameter set
.
To run specific template, specify the identity using --identity option.
dotnet new short --identity Templ.Identity1
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top GitHub Comments
For the
Authoring
case, I think this should be a warning and not an error.I ran my tool to identify templates that re-use the
identity
value across templates.I only found 4 IDs that are actually being used in different templates.
My report did include the following as well, but that is due to this bug https://github.com/dotnet/templating/issues/4140. Those are listed below.