diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs index dffb8be0d6..e8ddc804c2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs @@ -60,10 +60,22 @@ namespace Volo.Abp.Cli.ProjectBuilding args.TemplateSource ); - DeveloperApiKeyResult apiKeyResult; + DeveloperApiKeyResult apiKeyResult = null; #if DEBUG - apiKeyResult = _configuration.GetSection("apiKeyResult").Get(); //you can use user secrets + try + { + var apiKeyResultSection = _configuration.GetSection("apiKeyResult"); + if (apiKeyResultSection.Exists()) + { + apiKeyResult = apiKeyResultSection.Get(); //you can use user secrets + } + } + catch (Exception e) + { + Console.WriteLine(e); + } + if (apiKeyResult == null) { apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync();