Product
dotnet CLI (dotnet new)
Describe The Bug
dotnet new mstest --framework net47 fails with uninformative error, even in latest net10, because there are more choices, and a bug in the selection code.
This is our current template.json before fix: https://github.com/dotnet/sdk/blob/7b44ce4a89e829b1b7ce2d1d8309289ad977da3d/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-CSharp/.template.config/template.json#L32
A template that lists net472, net471 and net47, will fail for net47 option, because we will end up in the "multiple partial matches - cannot resolve" on line 210, never checking the precise match.
A template that lists net481, net48, will not fail for net48 option, because there is just a single partial match, and we will end up checking the exact match (line 204), and return on 198 because of precise match.
https://github.com/dotnet/templating/blob/main/src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/ParameterConverter.cs#L192-L217
We should be able to solve this by making the more precise choices first in our template.json, but the error is very uninformative, and does not mention the duplicate option, or parameter conflict.

To Reproduce
Steps:
1.
2.
3.
dotnet Info
output
Visual Studio Version
No response
Additional context
No response
Product
dotnet CLI (dotnet new)
Describe The Bug
dotnet new mstest --framework net47fails with uninformative error, even in latest net10, because there are more choices, and a bug in the selection code.This is our current template.json before fix: https://github.com/dotnet/sdk/blob/7b44ce4a89e829b1b7ce2d1d8309289ad977da3d/template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/content/MSTest-CSharp/.template.config/template.json#L32
A template that lists net472, net471 and net47, will fail for net47 option, because we will end up in the "multiple partial matches - cannot resolve" on line 210, never checking the precise match.
A template that lists net481, net48, will not fail for net48 option, because there is just a single partial match, and we will end up checking the exact match (line 204), and return on 198 because of precise match.
https://github.com/dotnet/templating/blob/main/src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/ParameterConverter.cs#L192-L217
We should be able to solve this by making the more precise choices first in our template.json, but the error is very uninformative, and does not mention the duplicate option, or parameter conflict.
To Reproduce
Steps:
1.
2.
3.
dotnet Info
output
Visual Studio Version
No response
Additional context
No response