skoruba / Duende.IdentityServer.Admin

The administration for the Duende IdentityServer and Asp.Net Core Identity ⚡
Apache License 2.0
556 stars 194 forks source link

dotnet new skoruba.duende.isadmin item with same key already added #100

Open tylerj-aft opened 1 year ago

tylerj-aft commented 1 year ago

Describe the bug

When I run the dotnet new command, I get the errors listed below.

To Reproduce

Steps to reproduce the behavior:

dotnet new skoruba.duende.isadmin --name Platform.Identity --title Platform.Identity --adminemail "admin@example.com" --adminpassword "Pa$$word123" --adminrole MyRole --adminclientid PlatformClientId --adminclientsecret PlatformClientSecret --dockersupport true

Relevant parts of the log file

An item with the same key has already been added. Key: -p:a
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at System.CommandLine.Parsing.StringExtensions.ValidTokens(Command command)
   at System.CommandLine.Parsing.StringExtensions.Tokenize(IReadOnlyList`1 args, CommandLineConfiguration configuration, Boolean inferRootCommand)
   at System.CommandLine.Parsing.Parser.Parse(IReadOnlyList`1 arguments, String rawInput)
   at Microsoft.TemplateEngine.Cli.Commands.InstantiateCommand.ReparseForTemplate(InstantiateCommandArgs args, IEngineEnvironmentSettings environmentSettings, TemplatePackageManager templatePackageManager, TemplateGroup templateGroup, CliTemplateInfo template, Boolean validateDefaultLanguage)
   at Microsoft.TemplateEngine.Cli.Commands.InstantiateCommand.ReparseForTemplate(InstantiateCommandArgs args, IEngineEnvironmentSettings environmentSettings, TemplatePackageManager templatePackageManager, TemplateGroup templateGroup, IEnumerable`1 templatesToReparse, Boolean& languageOptionSpecified)
   at Microsoft.TemplateEngine.Cli.Commands.InstantiateCommand.GetTemplateCommand(InstantiateCommandArgs args, IEngineEnvironmentSettings environmentSettings, TemplatePackageManager templatePackageManager, TemplateGroup templateGroup)
   at Microsoft.TemplateEngine.Cli.Commands.InstantiateCommand.HandleTemplateInstantationAsync(InstantiateCommandArgs args, IEngineEnvironmentSettings environmentSettings, TemplatePackageManager templatePackageManager, TemplateGroup templateGroup, CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Cli.Commands.InstantiateCommand.ExecuteIntAsync(InstantiateCommandArgs instantiateArgs, IEngineEnvironmentSettings environmentSettings, TemplatePackageManager templatePackageManager, InvocationContext context)
   at Microsoft.TemplateEngine.Cli.Commands.BaseCommand`1.InvokeAsync(InvocationContext context)
vulovicv23 commented 1 year ago

Same thing here:

 dotnet new -i Skoruba.IdentityServer4.Admin.Templates::2.1.0
Warning: use of 'dotnet new --install' is deprecated. Use 'dotnet new install' instead.
For more information, run:
   dotnet new install -h

The following template packages will be installed:
   Skoruba.IdentityServer4.Admin.Templates::2.1.0

Skoruba.IdentityServer4.Admin.Templates::2.1.0 is already installed.
To reinstall the same version of the template package, use '--force' option:
   dotnet new install Skoruba.IdentityServer4.Admin.Templates::2.1.0 --force

For details on the exit code, refer to https://aka.ms/templating-exit-codes#106

dotnet new skoruba.is4admin --name MyProject --title MyProject --adminemail "admin@example.com" --adminpassword "Pa$$word123" --adminrole MyRole --adminclientid MyClientId --adminclientsecret MyClientSecret --dockersupport true
An item with the same key has already been added. Key: -p:a
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at System.CommandLine.Parsing.StringExtensions.ValidTokens(Command command)
   at System.CommandLine.Parsing.StringExtensions.Tokenize(IReadOnlyList`1 args, CommandLineConfiguration configuration, Boolean inferRootCommand)
   at System.CommandLine.Parsing.Parser.Parse(IReadOnlyList`1 arguments, String rawInput)
   at Microsoft.TemplateEngine.Cli.Commands.InstantiateCommand.ReparseForTemplate(InstantiateCommandArgs args, IEngineEnvironmentSettings environmentSettings, TemplatePackageManager templatePackageManager, TemplateGroup templateGroup, CliTemplateInfo template, Boolean validateDefaultLanguage)
   at Microsoft.TemplateEngine.Cli.Commands.InstantiateCommand.ReparseForTemplate(InstantiateCommandArgs args, IEngineEnvironmentSettings environmentSettings, TemplatePackageManager templatePackageManager, TemplateGroup templateGroup, IEnumerable`1 templatesToReparse, Boolean& languageOptionSpecified)
   at Microsoft.TemplateEngine.Cli.Commands.InstantiateCommand.GetTemplateCommand(InstantiateCommandArgs args, IEngineEnvironmentSettings environmentSettings, TemplatePackageManager templatePackageManager, TemplateGroup templateGroup)
   at Microsoft.TemplateEngine.Cli.Commands.InstantiateCommand.HandleTemplateInstantationAsync(InstantiateCommandArgs args, IEngineEnvironmentSettings environmentSettings, ITelemetryLogger telemetryLogger, TemplatePackageManager templatePackageManager, TemplateGroup templateGroup, CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Cli.Commands.InstantiateCommand.ExecuteIntAsync(InstantiateCommandArgs instantiateArgs, IEngineEnvironmentSettings environmentSettings, ITelemetryLogger telemetryLogger, InvocationContext context)
   at Microsoft.TemplateEngine.Cli.Commands.BaseCommand`1.InvokeAsync(InvocationContext context)
skoruba commented 1 year ago

Thank you for reporting this issue - it looks like something has been changed in dot net tools probably.

I have to test it.

What version of .net tools do you use?

tylerj-aft commented 1 year ago

@skoruba I've tried it using Windows 11 with Powershell (.NET 6 and 7 SDKs installed) as well as on Ubuntu with same SDKs installed via WSL and a VS Code terminal window. Same result.

skoruba commented 1 year ago

@tylerj-aft - thanks for info, I will test it.

tylerj-aft commented 1 year ago

@skoruba when I removed .NET 7 RC 2 the template installs without issue. It's just the presence of .NET 7 preview it seems.

MarioBinder commented 1 year ago

@skoruba when I removed .NET 7 RC 2 the template installs without issue. It's just the presence of .NET 7 preview it seems.

@tylerj-aft Thanks! Same here. After removing the "7.0.100-rc.1.22431.12" Folder from "C:\Program Files\dotnet\sdk\" it works fine.

tylerj-aft commented 1 year ago

@MarioBinder @skoruba thanks. For that and other tooling challenges (bleeding edge), I'm backing off .NET 7 for now.

Adriien-M commented 1 year ago

It works with SDK v7.0.101

valdian commented 1 year ago

It works with SDK v7.0.101

I can confirm.

With SDK 7.0.100, I got the same error as in the initial post. Then I installed SDK 7.0.101, and it worked.