33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { AzureWizard , type IActionContext } from '@microsoft/vscode-azext-utils' ;
6+ import { AzureWizard , UserCancelledError , type IActionContext } from '@microsoft/vscode-azext-utils' ;
77import { window } from 'vscode' ;
88import { latestGAVersion , tryParseFuncVersion } from '../../FuncVersion' ;
99import { funcVersionSetting , projectLanguageSetting , projectOpenBehaviorSetting , projectTemplateKeySetting , type ProjectLanguage } from '../../constants' ;
1010import { ext } from '../../extensionVariables' ;
1111import { addLocalFuncTelemetry } from '../../funcCoreTools/getLocalFuncCoreToolsVersion' ;
1212import { tryGetLocalFuncVersion } from '../../funcCoreTools/tryGetLocalFuncVersion' ;
13+ import { validateFuncCoreToolsInstalled } from '../../funcCoreTools/validateFuncCoreToolsInstalled' ;
1314import { localize } from '../../localize' ;
1415import { getGlobalSetting , getWorkspaceSetting } from '../../vsCodeConfig/settings' ;
1516import type * as api from '../../vscode-azurefunctions.api' ;
@@ -18,6 +19,7 @@ import { FolderListStep } from './FolderListStep';
1819import { NewProjectLanguageStep } from './NewProjectLanguageStep' ;
1920import { OpenBehaviorStep } from './OpenBehaviorStep' ;
2021import { OpenFolderStep } from './OpenFolderStep' ;
22+ import { CreateDockerfileProjectStep } from './dockerfileSteps/CreateDockerfileProjectStep' ;
2123
2224/**
2325 * @deprecated Use AzureFunctionsExtensionApi.createFunction instead
@@ -54,6 +56,13 @@ export async function createNewProjectInternal(context: IActionContext, options:
5456 const wizardContext : Partial < IFunctionWizardContext > & IActionContext = Object . assign ( context , options , { language, version : tryParseFuncVersion ( version ) , projectTemplateKey } ) ;
5557 const optionalExecuteStep = options . executeStep ;
5658
59+ if ( optionalExecuteStep instanceof CreateDockerfileProjectStep ) {
60+ const message : string = localize ( 'installFuncTools' , 'You must have the Azure Functions Core Tools installed to run this command.' ) ;
61+ if ( ! await validateFuncCoreToolsInstalled ( context , message ) ) {
62+ throw new UserCancelledError ( 'validateFuncCoreToolsInstalled' ) ;
63+ }
64+ }
65+
5766 if ( options . folderPath ) {
5867 FolderListStep . setProjectPath ( wizardContext , options . folderPath ) ;
5968 }
@@ -70,6 +79,7 @@ export async function createNewProjectInternal(context: IActionContext, options:
7079 promptSteps : [ new FolderListStep ( ) , new NewProjectLanguageStep ( options . templateId , options . functionSettings ) , new OpenBehaviorStep ( ) ] ,
7180 executeSteps : optionalExecuteStep ? [ optionalExecuteStep , new OpenFolderStep ( ) ] : [ new OpenFolderStep ( ) ]
7281 } ) ;
82+
7383 await wizard . prompt ( ) ;
7484 await wizard . execute ( ) ;
7585
0 commit comments