diff --git a/scripts/execute-vscode-sideload.ps1 b/scripts/execute-vscode-sideload.ps1 new file mode 100644 index 0000000000..d727f7626f --- /dev/null +++ b/scripts/execute-vscode-sideload.ps1 @@ -0,0 +1,36 @@ +param ( + [string] + [Parameter(Mandatory = $false)] + $Platform = "win-x64", + [switch] + $WSL +) + + +Push-Location ./vscode/microsoft-kiota + +# Install all dependencies +npm i + +# Package the VS Code extension +npx @vscode/vsce package + +# Getting package for its version +$PackageJson = Get-Content "package.json" -Raw | ConvertFrom-Json + +# Install the extension +code --install-extension "./kiota-$($PackageJson.version).vsix" + +$VsCodeRootPath = "~/.vscode" + +if ($WSL) { + $Platform = "linux-x64" + $VsCodeRootPath = "~/.vscode-server" +} + +$KiotaBin = "$VsCodeRootPath/extensions/ms-graph.kiota-$($PackageJson.version)/.kiotabin/$($PackageJson.kiotaVersion)/$Platform" + +Pop-Location + +# Building Kiota +dotnet publish ./src/kiota/kiota.csproj -p:PublishSingleFile=true -p:PublishReadyToRun=true --self-contained -c Release -r $platform -o $KiotaBin \ No newline at end of file diff --git a/vscode/microsoft-kiota/debugging.md b/vscode/microsoft-kiota/debugging.md index 4d8c88011a..bd3cfc59d9 100644 --- a/vscode/microsoft-kiota/debugging.md +++ b/vscode/microsoft-kiota/debugging.md @@ -47,6 +47,20 @@ Where kiotaVersionInPackage is the kiotaVersion field and versionInPackage is th > Note: alternatively to building executable yourself, you can download it from [the pipeline](https://github.com/microsoft/kiota/actions/workflows/dotnet.yml) by filtering the branch (top right corner) with the pull request branch, selecting the latest run, and downloading the right OS version from the artifacts. The only remaining work will be to move the downloaded files to the right path above. +#### Using the ready-made script + +If you want to automate these steps, you can use the following script to automate the process: + +```powershell +.\scripts\execute-vscode-sideload.ps1 -Platform "win-x64|linux-x64|osx-x64" +``` + +If you are using WSL, you can use the following: + +```powershell +.\scripts\execute-vscode-sideload.ps1 -WSL +``` + ## FAQ ### VS Code keeps reinstalling from the marketplace