Skip to content

Latest commit

 

History

History
99 lines (70 loc) · 3.42 KB

File metadata and controls

99 lines (70 loc) · 3.42 KB

Power Platform Project Setup Demo

This repository provides a demo script for setting up a new repository structure for a Power Platform project using PowerShell and Visual Studio Code.

Warning

The snippets are work in progress and they are not finished!

You can watch the related walkthrough videos on our YouTube channel:
📺 Power Platform Demo Playlist

Prerequisites

  1. Install Visual Studio Code
    Download VS Code

  2. Install PowerShell (macOS only)
    This demo uses PowerShell scripts. On macOS, install PowerShell using the following command:

    dotnet tool install --global PowerShell

Setup Instructions

  1. Open PowerShell terminal in a folder where we will start building a repo

    image

Tip

macOS: you can start PowerShell from Terminal by running pwsh

  1. Create a working directory and required folders

    mkdir dev-loop-demo; `
    mkdir dev-loop-demo/.vscode; `
    mkdir dev-loop-demo/.demo; `
    code -r dev-loop-demo
  2. Open PowerShell in VS Code

    • Press Ctrl + `
    • Or use the menu: Terminal → New Terminal

Tip

macOS: Cmd + J shortcut + Run pwsh to enter PowerShell

  1. Download the code snippet files by running the following command

    (Invoke-RestMethod 'https://api.github.com/repos/TALXIS/docs-patterns-practices/contents/dev-loops?ref=master') | Where-Object { $_.type -eq 'file' -and $_.name -like '*.code-snippets' -and $_.download_url } | ForEach-Object { Invoke-WebRequest $_.download_url -OutFile ".vscode\$($_.name)" }; (Invoke-RestMethod 'https://api.github.com/repos/TALXIS/docs-patterns-practices/contents/dev-loops/scripts?ref=master') | Where-Object { $_.type -eq 'file' -and $_.name -eq 'DemoVariables.ps1' -and $_.download_url } | ForEach-Object { Invoke-WebRequest $_.download_url -OutFile ".demo\DemoVariables.ps1" }

Warning

GitHub API might return an error 'No server is currently available to service your request' In such case, wait few moments and execute the command again.

  1. Create a PowerShell script file to use during the demo and open it

    New-Item -ItemType File -Name '.demo/DemoScriptPad.ps1'; `
    code .demo/DemoScriptPad.ps1
  2. Start typing in the script file

    Start typing CFA to insert the first snippet. Select the right snippet with arrows and confirm with the enter key.

  3. Optional: Bind F5 to clear the terminal and run the whole script

    Paste the following into the terminal to create a custom keybinding:

    $keybinding = @'
    [
        {
            "key": "f5",
            "command": "runCommands",
            "args": {
                "commands": [
                    "workbench.action.terminal.clear",
                    "PowerShell.Debug.Start"
                ]
            },
            "when": "editorTextFocus && editorLangId == 'powershell'"
        }
    ]

'@

$path = ".vscode/keybindings.json" if (-not (Test-Path ".vscode")) { mkdir .vscode } Set-Content -Path $path -Value $keybinding


10. **Running the script**

- Press `F8` to run selected lines of code
- Press `F5` to run the whole script (after setting up the keybinding in the previous step)