Closed asears closed 2 years ago
@asears
Thank you for the issue, indeed most of concerns are valid.
Some suggestion on how to address the duplicate template error with an --uninstall suggestion or some warning on install might be useful for devs. This is a bug, I will address it. Other cases suggest uninstalling the template as possible workaroung
I was still unable to see the source of this template with all columns enabled. Could include the nuget package identifier in the column list.
This is tracked in https://github.com/dotnet/templating/issues/2909.
the recommendation could provide some security slant to the recommendations for Microsoft.DotNet.Common.ItemTemplates and others distributed by Microsoft vs. community or organization templates. It shouldn't recommend uninstalling an official template.
Uninstalling official template is not possible, that's why we are considering https://github.com/dotnet/templating/issues/4135 for I while (i extracted it to separate issue so we can track it separately). Author column may guide you on who authored the template, but it is not shown by default. @baronfel should we consider more visible way to distinguish Microsoft templates from 3rd party when showing the list?
I think the message could be changed to not suggest uninstalling Microsoft-authored templates, and perhaps the message when uninstalling a Microsoft-authored should be updated to let the user know this is disallowed. I'm not sure that denoting Microsoft templates in any other way than the Author column is going to be something that's generally useful, though.
Some suggestion on how to address the duplicate template error with an --uninstall suggestion or some warning on install might be useful for devs. This is a bug, I will address it. Other cases suggest uninstalling the template as possible workaroung
The problem above was fixed while migrating to new parser, the new output is below:
Unable to resolve the template, the following installed templates are conflicting:
Identity Template Name Short Name Language Author Package
%TABLE HEADER DELIMITER%
Invalid.SameShortName.TemplateA Invalid.SameSho... sameshortname Test Asset %TEMPLATE LOCATION%
Invalid.SameShortName.TemplateB Invalid.SameSho... sameshortname Test Asset %TEMPLATE LOCATION%
Uninstall the template packages containing the templates to keep only one template from the list or add the template options which differentiate the template to run.
This output suggests to uninstall the package in case of the conflict. This is not yet perfect, as still there is no way to run the templates that have same short name. We plan to improve this behavior in https://github.com/dotnet/templating/issues/4135.
I was still unable to see the source of this template with all columns enabled. Could include the nuget package identifier in the column list.
This is tracked in https://github.com/dotnet/templating/issues/2909, please follow it.
I'm closing this issue now, the remaining work will be done in https://github.com/dotnet/templating/issues/4135 and https://github.com/dotnet/templating/issues/2909.
This will likely not happen in the wild too often but might be a minor security concern if "official" template identifier was replaced with another one. The workflow is a bit confusing since it allows for this scenario of duplicate template identifiers when installing templates.
I can see that it's been addressed by adding a '2' to the suffix of some templates.
Repro
Running
dotnet new --install Microsoft.DotNet.Common.ItemTemplates::6.0.100
and thendotnet new editorconfig
results in the following error which isn't so helpful in tracking down where the template was sourced from and the command to uninstall it.Unable to resolve the template, these templates matched your input:
Suggestions
Some suggestion on how to address the duplicate template error with an --uninstall suggestion or some warning on install might be useful for devs.
I was still unable to see the source of this template with all columns enabled. Could include the nuget package identifier in the column list.
Fix
In my case, the correct answer was not below:
I used this to address
Template url: https://www.nuget.org/packages/Duotify.Templates.DotNetNew
Templates installed
This installed list probably isn't reflective of what's in the wild and is on one of my lab machines. Some of these might be out of date and contain security issues.