import * as fse from 'fs-extra' ; import * as path from 'path' ; import { IActionContext } from 'vscode-azureextensionui' ; import { ext } from '../extensionVariables' ; import { localize } from '../localize' ; import { cpUtils } from '../utils/cpUtils' ; import { dotnetUtils } from '../utils/dotnetUtils' ; import { checkCsharpExtensionInstalled } from '../utils/extensionUtil' ; import { getDefaultWorkspacePath } from '../utils/fsUtil' ; export async function setupWorkingFolder ( this ) { ext . outputChannel . appendLine ( localize ( "folderInitialized" , "Initialization started..." ) ) ; ext . outputChannel . show ( ) ; await dotnetUtils . validateDotnetInstalled ( this ) ; checkCsharpExtensionInstalled ( this ) ; const workingFolderPath = getDefaultWorkspacePath ( ) ; await fse . emptyDir ( workingFolderPath ) ; await cpUtils . executeCommand ( ext . outputChannel , workingFolderPath , 'dotnet' , 'new' , 'web' ) ; await fse . copy ( ext . context . asAbsolutePath ( path . join ( 'resources' , 'projectFiles' ) ) , workingFolderPath , { overwrite : true , recursive : false } ) ; await cpUtils . executeCommand ( ext . outputChannel , workingFolderPath , 'dotnet' , 'add' , 'package' , 'Newtonsoft.Json' ) ; await cpUtils . executeCommand ( ext . outputChannel , workingFolderPath , 'dotnet' , 'build' ) ; ext . outputChannel . appendLine ( localize ( "folderInitialized" , "Initialization completed!" ) ) ; ext . outputChannel . appendLine ( localize ( "closePolicyFiles" , "Please close and reopen any open policy files." ) ) ; ext . outputChannel . show ( ) ; }