Describe the bug
A clear and concise description of what the bug is.
When I ran dotnet new console, I got the following as part of the output:
Error: Failed to load template from "C:\Program Files\dotnet\templates\7.0.20\microsoft.dotnet.test.projecttemplates.7.0.1.1.0-rc.23559.1.nupkg(
/content/NUnit-CSharp/.template.config/template.json)".
Details: System.ArgumentException: An item with the same key has already been added. Key: defaultName (Parameter 'key')
at System.Collections.ThrowHelper.ThrowDuplicateKey[TKey](TKey key)
at System.Collections.Generic.OrderedDictionary`2.TryInsert(Int32 index, TKey key, TValue value, InsertionBehavior behavior, Int32& keyIndex)
at System.Collections.Generic.OrderedDictionary`2.Add(TKey key, TValue value)
at System.Text.Json.Nodes.JsonObject.InitializeDictionary()
at System.Text.Json.Nodes.JsonObject.TryGetPropertyValue(String propertyName, JsonNode& jsonNode, Int32& index)
at System.Text.Json.Nodes.JsonObject.TryGetPropertyValue(String propertyName, JsonNode& jsonNode)
at Microsoft.TemplateEngine.JExtensions.GetPropertyCaseInsensitive(JsonObject obj, String key)
at Microsoft.TemplateEngine.JExtensions.Get[T](JsonNode token, String key)
at Microsoft.TemplateEngine.JExtensions.ArrayAsStrings(JsonNode token, String propertyName)
at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.DirectoryBasedTemplate.MergeAdditionalConfiguration(JsonObject primarySource,
IFileSystemInfo primarySourceConfig)
at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.DirectoryBasedTemplate..ctor(IEngineEnvironmentSettings settings, IGenerator
generator, IFile templateFile, String baselineName)
at Microsoft.TemplateEngine.Orchestrator.RunnableProjects.RunnableProjectGenerator.GetTemplatesFromMountPointInternalAsync(IMountPoint
source, CancellationToken cancellationToken)
The template "Console App" was created successfully.
This is caused by an issue with the template that has been fixed a long time ago (dotnet/test-templates#105), but it still happens on .Net 11 if you have the .Net 7 SDK installed.
I believe this would have been fixed by dotnet/templating#10048, but that was never merged.
To Reproduce
- Have .Net 7 and .Net 11 SDKs installed.
- On .Net 11 SDK, run
dotnet new console.
cc: @marcpopMSFT
Describe the bug
A clear and concise description of what the bug is.
When I ran
dotnet new console, I got the following as part of the output:This is caused by an issue with the template that has been fixed a long time ago (dotnet/test-templates#105), but it still happens on .Net 11 if you have the .Net 7 SDK installed.
I believe this would have been fixed by dotnet/templating#10048, but that was never merged.
To Reproduce
dotnet new console.cc: @marcpopMSFT