diff --git a/src/Azure.Functions.Cli/Actions/LocalActions/CreateFunctionAction.cs b/src/Azure.Functions.Cli/Actions/LocalActions/CreateFunctionAction.cs index 383180c8b..514dd7581 100644 --- a/src/Azure.Functions.Cli/Actions/LocalActions/CreateFunctionAction.cs +++ b/src/Azure.Functions.Cli/Actions/LocalActions/CreateFunctionAction.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading.Tasks; using Azure.Functions.Cli.Common; +using Azure.Functions.Cli.ExtensionBundle; using Azure.Functions.Cli.Helpers; using Azure.Functions.Cli.Interfaces; using Azure.Functions.Cli.Telemetry; @@ -156,7 +157,13 @@ public async override Task RunAsync() else { TelemetryHelpers.AddCommandEventToDictionary(TelemetryCommandEvents, "template", TemplateName); - ExtensionsHelper.EnsureDotNetForExtensions(template); + + var extensionBundleManager = ExtensionBundleHelper.GetExtensionBundleManager(); + if (template.Metadata.Extensions != null && !extensionBundleManager.IsExtensionBundleConfigured() && !CommandChecker.CommandExists("dotnet")) + { + throw new CliException($"The {template.Metadata.Name} template has extensions. {Constants.Errors.ExtensionsNeedDotnet}"); + } + ColoredConsole.Write($"Function name: [{template.Metadata.DefaultFunctionName}] "); FunctionName = FunctionName ?? Console.ReadLine(); FunctionName = string.IsNullOrEmpty(FunctionName) ? template.Metadata.DefaultFunctionName : FunctionName; diff --git a/src/Azure.Functions.Cli/Helpers/ExtensionsHelper.cs b/src/Azure.Functions.Cli/Helpers/ExtensionsHelper.cs index 7da02f179..9134a1da2 100644 --- a/src/Azure.Functions.Cli/Helpers/ExtensionsHelper.cs +++ b/src/Azure.Functions.Cli/Helpers/ExtensionsHelper.cs @@ -72,12 +72,5 @@ public static IEnumerable GetExtensionPackages() return packages.Values; } - public static void EnsureDotNetForExtensions(Template template) - { - if (template.Metadata.Extensions != null && !CommandChecker.CommandExists("dotnet")) - { - throw new CliException($"The {template.Metadata.Name} template has extensions. {Constants.Errors.ExtensionsNeedDotnet}"); - } - } } }