protected async executeCore()

in src/commands/initProjectForVSCode/InitVSCodeStep/DotnetInitVSCodeStep.ts [49:94]


    protected async executeCore(context: IProjectWizardContext): Promise<void> {
        const projectPath: string = context.projectPath;
        const language: ProjectLanguage = nonNullProp(context, 'language');

        let projFile: dotnetUtils.ProjectFile;
        const projFiles: dotnetUtils.ProjectFile[] = await dotnetUtils.getProjFiles(context, language, projectPath);
        const fileExt: string = language === ProjectLanguage.FSharp ? 'fsproj' : 'csproj';
        if (projFiles.length === 1) {
            projFile = projFiles[0];
        } else if (projFiles.length === 0) {
            context.errorHandling.suppressReportIssue = true;
            throw new Error(localize('projNotFound', 'Failed to find {0} file in folder "{1}".', fileExt, path.basename(projectPath)));
        } else {
            context.errorHandling.suppressReportIssue = true;
            throw new Error(localize('projNotFound', 'Expected to find a single {0} file in folder "{1}", but found multiple instead: {2}.', fileExt, path.basename(projectPath), projFiles.join(', ')));
        }

        const versionInProjFile: string | undefined = await dotnetUtils.tryGetFuncVersion(projFile);
        context.telemetry.properties.versionInProjFile = versionInProjFile;
        // The version from the proj file takes precedence over whatever was set in `context` before this
        context.version = tryParseFuncVersion(versionInProjFile) || context.version;

        if (context.version === FuncVersion.v1) {
            const settingKey: string = 'show64BitWarning';
            if (getWorkspaceSetting<boolean>(settingKey)) {
                const message: string = localize('64BitWarning', 'In order to debug .NET Framework functions in VS Code, you must install a 64-bit version of the Azure Functions Core Tools.');
                try {
                    const result: MessageItem = await context.ui.showWarningMessage(message, { stepName: 'netDebug64bit' }, DialogResponses.learnMore, DialogResponses.dontWarnAgain);
                    if (result === DialogResponses.learnMore) {
                        await openUrl('https://aka.ms/azFunc64bit');
                    } else if (result === DialogResponses.dontWarnAgain) {
                        await updateGlobalSetting(settingKey, false);
                    }
                } catch (err) {
                    // swallow cancellations (aka if they clicked the 'x' button to dismiss the warning) and proceed to create project
                    if (!parseError(err).isUserCancelledError) {
                        throw err;
                    }
                }
            }
        }

        const targetFramework: string = await dotnetUtils.getTargetFramework(projFile);
        this.setDeploySubpath(context, `bin/Release/${targetFramework}/publish`);
        this._debugSubpath = dotnetUtils.getDotnetDebugSubpath(targetFramework);
    }