From cacde427028a00f15ca8e76f7f9c75a0dbfa248c Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Fri, 9 May 2025 12:31:15 -0700 Subject: [PATCH 01/22] Modernize Dev Container Configuration for PowerShell Development --- .devcontainer/Dockerfile | 25 -------- .devcontainer/devcontainer.json | 76 +++++++++++++++++------ .devcontainer/scripts/1-onCreate.ps1 | 38 ++++++++++++ .devcontainer/scripts/2-updateContent.ps1 | 29 +++++++++ .devcontainer/scripts/3-postCreate.ps1 | 1 + .devcontainer/scripts/4-postStart.ps1 | 1 + .devcontainer/scripts/5-postAttach.ps1 | 1 + .devcontainer/scripts/shared.ps1 | 19 ++++++ .vscode/launch.json | 5 +- .vscode/tasks.json | 47 +++++++++++--- 10 files changed, 188 insertions(+), 54 deletions(-) delete mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/scripts/1-onCreate.ps1 create mode 100644 .devcontainer/scripts/2-updateContent.ps1 create mode 100644 .devcontainer/scripts/3-postCreate.ps1 create mode 100644 .devcontainer/scripts/4-postStart.ps1 create mode 100644 .devcontainer/scripts/5-postAttach.ps1 create mode 100644 .devcontainer/scripts/shared.ps1 diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index c849a9f78e5..00000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -#------------------------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. -#------------------------------------------------------------------------------------------------------------- - -FROM mcr.microsoft.com/powershell/test-deps:ubuntu-20.04@sha256:d1609c57d2426b9cfffa3a3ab7bda5ebc4448700f8ba8ef377692c4a70e64b8c - -# Avoid warnings by switching to noninteractive -ENV DEBIAN_FRONTEND=noninteractive - -# Configure apt and install packages -RUN apt-get update \ - && apt-get -y upgrade \ - && apt-get -y install --no-install-recommends apt-utils 2>&1 \ - # - # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed - && apt-get -y install --no-install-recommends git procps lsb-release \ - # - # Clean up - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -# Switch back to dialog for any ad-hoc use of apt-get -ENV DEBIAN_FRONTEND=dialog diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index eded2d1bdec..cabf0bf870b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,23 +1,63 @@ -// See https://aka.ms/vscode-remote/devcontainer.json for format details. +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet { - "name": ".NET Core 6.0, including pwsh (Ubuntu 18.04)", - "dockerFile": "Dockerfile", + "name": "PowerShell Development", + // NOTE: This should be kept up to date to match the .NET SDK currently in use on the master branch. + // but not mandatory as we fetch the appropriate .NET SDK as needed during build. + "image": "mcr.microsoft.com/devcontainers/dotnet:dev-10.0-preview-noble", + "hostRequirements": { + "cpus": 4 + }, - "workspaceMount": "source=${localWorkspaceFolder},target=/PowerShell,type=bind", - "workspaceFolder": "/PowerShell", + // Bind the working folder to /powershell instead of /workspaces/PowerShell + "workspaceMount": "source=${localWorkspaceFolder},target=/powershell,type=bind,consistency=cached", + "workspaceFolder": "/powershell", - // Uncomment the next line to run commands after the container is created. - "postCreateCommand": "cd src/powershell-unix && dotnet restore", + // Container lifecycle scripts + // Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts - "customizations": { - "vscode": { - "extensions": [ - "ms-azure-devops.azure-pipelines", - "ms-dotnettools.csharp", - "ms-vscode.powershell", - "DavidAnson.vscode-markdownlint", - "vitaliymaz.vscode-svg-previewer" - ] - } - } + //NOTE: We don't use initializeCommand because that runs on the host and we may not know what OS it is. + "onCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/1-onCreate.ps1"], + "updateContentCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/2-updateContent.ps1"], + + // These lifecycle scripts are non-blocking to loading the codespace and UI by default + // "postCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/3-postCreate.ps1"], + "postStartCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/4-postStart.ps1"], + // "postAttachCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/5-postAttach.ps1"], + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "settings": { + "dotnet.defaultSolution": "PowerShell.sln", + "dotnet.testWindow.useTestingPlatformProtocol": true, + "csharp.experimental.debug.hotReload": true, + "powershell.powerShellAdditionalExePaths": { + "PowerShell-Devcontainer": "/usr/bin/pwsh", + "PowerShell-DevBuild": "/powershell/debug/pwsh" + }, + "powershell.powerShellDefaultVersion": "PowerShell-Devcontainer", + "terminal.integrated.defaultProfile.linux": "pwsh", + "terminal.integrated.profiles.linux": { + "pwsh dev": { + "path": "${workspaceFolder}/debug/pwsh", + "icon": "terminal-powershell", + "color": "terminal.ansiMagenta" + } + } + }, + "extensions": [ + "ms-dotnettools.csharp", + "ms-dotnettools.csdevkit", //Free for open source projects + "ms-vscode.PowerShell", + "ms-azure-devops.azure-pipelines", + "github.vscode-pull-request-github" + ] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // Generally not necessary because sudo is available in the container. + // NOTE: if using Windows Docker Desktop or WSL, you need to add options = "metadata,uid=1000,gid=1000" to wsl.conf to avoid permissions errors. You can also uncomment this to use root, but it is not recommended + // "remoteUser": "root" } diff --git a/.devcontainer/scripts/1-onCreate.ps1 b/.devcontainer/scripts/1-onCreate.ps1 new file mode 100644 index 00000000000..76b80828a42 --- /dev/null +++ b/.devcontainer/scripts/1-onCreate.ps1 @@ -0,0 +1,38 @@ +#Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts +. $PSScriptRoot/shared.ps1 + +log "Adding $SCRIPT:WorkspaceFolder to git safe directories" +git config --global --add safe.directory $SCRIPT:WorkspaceFolder + +# WorkspaceFolder might end up as a different path, so link it if it is not +# This is so any scripts that require a hardcoded path to the workspace folder can use it +$defaultWorkspaceFolder = '/powershell' +if (-not (Test-Path $defaultWorkspaceFolder)) { + log "Linking $defaultWorkspaceFolder to $SCRIPT:WorkspaceFolder" + & sudo ln -s $SCRIPT:WorkspaceFolder $defaultWorkspaceFolder + git config --global --add safe.directory $defaultWorkspaceFolder +} + +# NOTE: We override the Azure Devops private feed as it may not be up to date with the required packages +# This is only for development and not builds so any potential vulnerabilities will be caught at CI time +# If you want to restore private restore behavior for testing, perform the following: +# PS> dotnet nuget disable source nuget.org;dotnet nuget enable source powershell + +#Because several PowerSHell build steps request you to use -UseNugetOrg, these files get changed when you do that. We ignore this in the codespaces so they do not get accidentally committed to PRs. You can always use --no-skip-worktree after build if you intentionally want to modify these files. +log 'Ignoring nuget.config changes' +git update-index --skip-worktree nuget.config src/Modules/nuget.config test/tools/Modules/nuget.config + +log 'Switching to Nuget.Org Packages Only for Codespaces Development' +Import-Module ./build.psm1 +Switch-PSNugetConfig -Source NuGetOnly + +#Install latest .NET specified by the PowerShell global.json file. Start-PSBootstrap can do this but we want to ensure it goes into the devcontainer global directory. +Push-Location /tmp +try { + & curl -LOs https://dot.net/v1/dotnet-install.sh + & chmod +x dotnet-install.sh + log 'Checking if PowerShell global.json dotnet SDK version is installed' + & sudo ./dotnet-install.sh --install-dir /usr/share/dotnet --jsonfile $WorkspaceFolder/global.json +} finally { + Pop-Location +} diff --git a/.devcontainer/scripts/2-updateContent.ps1 b/.devcontainer/scripts/2-updateContent.ps1 new file mode 100644 index 00000000000..0967624cdc9 --- /dev/null +++ b/.devcontainer/scripts/2-updateContent.ps1 @@ -0,0 +1,29 @@ +#Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts +. $PSScriptRoot/shared.ps1 + +#If doing a clone into devcontainer, VSCode defaults to a shallow clone. The build process does not support shallow +#clones due to the use of git tag describe, so we must "unshallow" it if this occurs +if ([bool](git rev-parse --is-shallow-repository)) { + log 'Shallow Clone detected, this is not supported by the PowerShell build process. Unshallowing...' + git fetch --unshallow +} + +# Fetch upstream tags. The PowerShell dotnet restore requires this (GetPSCoreVersionFromGit) +Import-Module -Force ./build.psm1 +Sync-PSTags -AddRemoteIfMissing + +log 'Bootstrap PowerShell Prerequisites' +& sudo pwsh -c { + Import-Module -Force ./build.psm1 + Start-PSBootstrap -Scenario DotNet +} + +# Perform a build if Github Codespaces prebuild, otherwise optimize to start quickly +if ($ENV:CODESPACES) { + $outputPath = Join-Path $SCRIPT:WorkspaceFolder 'debug' + log "Prebuilding PowerShell for Codespaces to $outputPath" + Start-PSBuild -UseNugetOrg -Clean -Output $outputPath + + log 'Prebuilding Tests' + dotnet build test/xUnit test/Modules +} diff --git a/.devcontainer/scripts/3-postCreate.ps1 b/.devcontainer/scripts/3-postCreate.ps1 new file mode 100644 index 00000000000..945161a2970 --- /dev/null +++ b/.devcontainer/scripts/3-postCreate.ps1 @@ -0,0 +1 @@ +#Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts diff --git a/.devcontainer/scripts/4-postStart.ps1 b/.devcontainer/scripts/4-postStart.ps1 new file mode 100644 index 00000000000..945161a2970 --- /dev/null +++ b/.devcontainer/scripts/4-postStart.ps1 @@ -0,0 +1 @@ +#Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts diff --git a/.devcontainer/scripts/5-postAttach.ps1 b/.devcontainer/scripts/5-postAttach.ps1 new file mode 100644 index 00000000000..945161a2970 --- /dev/null +++ b/.devcontainer/scripts/5-postAttach.ps1 @@ -0,0 +1 @@ +#Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts diff --git a/.devcontainer/scripts/shared.ps1 b/.devcontainer/scripts/shared.ps1 new file mode 100644 index 00000000000..dba4a34b801 --- /dev/null +++ b/.devcontainer/scripts/shared.ps1 @@ -0,0 +1,19 @@ +function log ([string[]]$message) { + $message = $message -join ' ' + Write-Host -ForegroundColor Cyan $message +} + +#Devcontainer scripts should have their CWD set to the workspace folder, so we use this for our needed paths +$SCRIPT:WorkspaceFolder = $PWD + +# Suppresses ANSI Output in Codespaces Build Output +# $env:CODESPACES is a "magic variable" in the codespaces CI that can be used to detect it +if ($env:CODESPACES) { + [Environment]::SetEnvironmentVariable('TERM', 'dumb', [EnvironmentVariableTarget]::User) + [Environment]::SetEnvironmentVariable('TERM', 'dumb', [EnvironmentVariableTarget]::Process) + $ENV:TERM = 'dumb' + $ENV:NO_COLOR = $true + $ENV:DOTNET_CLI_CONTEXT_ANSI_PASS_THRU = $false + $ENV:DOTNET_CLI_CONTEXT_VERBOSE = $false + $PSStyle.OutputRendering = 'PlainText' +} diff --git a/.vscode/launch.json b/.vscode/launch.json index 4ba261df08c..c932620bfe8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,11 +5,10 @@ "name": ".NET Core Launch", "type": "coreclr", "request": "launch", - "justMyCode": false, - "stopAtEntry": true, "program": "${workspaceRoot}/debug/pwsh", + "console": "integratedTerminal", + "justMyCode": false, "preLaunchTask": "Build", - "externalConsole": true, "cwd": "${workspaceRoot}" }, { diff --git a/.vscode/tasks.json b/.vscode/tasks.json index b92aaddeb0d..02bebf7736c 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -39,26 +39,57 @@ "tasks": [ { - "label": "Bootstrap", + "label": "Build", "type": "shell", - "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBootstrap", - "problemMatcher": [] + "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBuild -Output (Join-Path '${workspaceFolder}' debug)", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": "$msCompile" }, { - "label": "Clean Build", + "label": "Build - Clean", "type": "shell", "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBuild -Clean -Output (Join-Path '${workspaceFolder}' debug)", + "group": { + "kind": "build", + }, "problemMatcher": "$msCompile" }, { - "label": "Build", + "label": "Bootstrap", "type": "shell", - "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBuild -Output (Join-Path '${workspaceFolder}' debug)", + "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBootstrap", + "problemMatcher": [] + }, + { + "label": "Test", + "dependsOn": [ + "Test - Pester", + "Test - xUnit" + ], "group": { - "kind": "build", + "kind": "test", "isDefault": true + } + }, + { + "label": "Test - Pester", + "type": "shell", + "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSPester -powershell '${workspaceFolder}/debug'", + "group": { + "kind": "test", }, - "problemMatcher": "$msCompile" + }, + { + "label": "Test - xUnit", + "type": "shell", + "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSXUnit", + "group": { + "kind": "test" + } } ] + } From 129db4e6e0bae50f0b55d6a5ae5bcf6f6944c1d1 Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 10 May 2025 06:14:06 +0000 Subject: [PATCH 02/22] Further Devcontainer Updates --- .devcontainer/devcontainer.json | 22 +++++++++++++++------- .devcontainer/scripts/1-onCreate.ps1 | 13 ++----------- .devcontainer/scripts/2-updateContent.ps1 | 18 +++++++++--------- .vscode/launch.json | 1 + .vscode/tasks.json | 12 ++++++------ 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index cabf0bf870b..861cf46a394 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,7 @@ "name": "PowerShell Development", // NOTE: This should be kept up to date to match the .NET SDK currently in use on the master branch. // but not mandatory as we fetch the appropriate .NET SDK as needed during build. - "image": "mcr.microsoft.com/devcontainers/dotnet:dev-10.0-preview-noble", + "image": "mcr.microsoft.com/devcontainers/dotnet:1-10.0-preview-noble", "hostRequirements": { "cpus": 4 }, @@ -13,6 +13,19 @@ "workspaceMount": "source=${localWorkspaceFolder},target=/powershell,type=bind,consistency=cached", "workspaceFolder": "/powershell", + "capAdd": [ + "NET_RAW" // Needed for Pester tests that require ping + ], + + "remoteUser": "vscode", + "containerUser": "vscode", + + // This is required if the dotnet is updated to a later version than what is in the image. + // So that the C# extension can detect it. Doing it in .bashrc is not enough. + "remoteEnv": { + "PATH": "/home/vscode/.dotnet:${containerEnv:PATH}" + }, + // Container lifecycle scripts // Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts @@ -22,7 +35,7 @@ // These lifecycle scripts are non-blocking to loading the codespace and UI by default // "postCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/3-postCreate.ps1"], - "postStartCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/4-postStart.ps1"], + // "postStartCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/4-postStart.ps1"], // "postAttachCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/5-postAttach.ps1"], // Configure tool-specific properties. @@ -55,9 +68,4 @@ ] } } - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // Generally not necessary because sudo is available in the container. - // NOTE: if using Windows Docker Desktop or WSL, you need to add options = "metadata,uid=1000,gid=1000" to wsl.conf to avoid permissions errors. You can also uncomment this to use root, but it is not recommended - // "remoteUser": "root" } diff --git a/.devcontainer/scripts/1-onCreate.ps1 b/.devcontainer/scripts/1-onCreate.ps1 index 76b80828a42..6649654797a 100644 --- a/.devcontainer/scripts/1-onCreate.ps1 +++ b/.devcontainer/scripts/1-onCreate.ps1 @@ -13,6 +13,8 @@ if (-not (Test-Path $defaultWorkspaceFolder)) { git config --global --add safe.directory $defaultWorkspaceFolder } + + # NOTE: We override the Azure Devops private feed as it may not be up to date with the required packages # This is only for development and not builds so any potential vulnerabilities will be caught at CI time # If you want to restore private restore behavior for testing, perform the following: @@ -25,14 +27,3 @@ git update-index --skip-worktree nuget.config src/Modules/nuget.config test/tool log 'Switching to Nuget.Org Packages Only for Codespaces Development' Import-Module ./build.psm1 Switch-PSNugetConfig -Source NuGetOnly - -#Install latest .NET specified by the PowerShell global.json file. Start-PSBootstrap can do this but we want to ensure it goes into the devcontainer global directory. -Push-Location /tmp -try { - & curl -LOs https://dot.net/v1/dotnet-install.sh - & chmod +x dotnet-install.sh - log 'Checking if PowerShell global.json dotnet SDK version is installed' - & sudo ./dotnet-install.sh --install-dir /usr/share/dotnet --jsonfile $WorkspaceFolder/global.json -} finally { - Pop-Location -} diff --git a/.devcontainer/scripts/2-updateContent.ps1 b/.devcontainer/scripts/2-updateContent.ps1 index 0967624cdc9..f37576feafb 100644 --- a/.devcontainer/scripts/2-updateContent.ps1 +++ b/.devcontainer/scripts/2-updateContent.ps1 @@ -3,7 +3,7 @@ #If doing a clone into devcontainer, VSCode defaults to a shallow clone. The build process does not support shallow #clones due to the use of git tag describe, so we must "unshallow" it if this occurs -if ([bool](git rev-parse --is-shallow-repository)) { +if ((git rev-parse --is-shallow-repository) -ne 'false') { log 'Shallow Clone detected, this is not supported by the PowerShell build process. Unshallowing...' git fetch --unshallow } @@ -12,18 +12,18 @@ if ([bool](git rev-parse --is-shallow-repository)) { Import-Module -Force ./build.psm1 Sync-PSTags -AddRemoteIfMissing -log 'Bootstrap PowerShell Prerequisites' -& sudo pwsh -c { - Import-Module -Force ./build.psm1 - Start-PSBootstrap -Scenario DotNet -} +log 'Bootstrap PowerShell Build Prerequisites' +Import-Module -Force ./build.psm1 +Start-PSBootstrap -Scenario DotNet + +#Ping is needed for tests but is not included in the .NET SDK devcontainer and PSBootstrap doesn't cover it +log 'Installing iputils (for the ping utility)' +sudo apt install iputils-ping -y # Perform a build if Github Codespaces prebuild, otherwise optimize to start quickly if ($ENV:CODESPACES) { - $outputPath = Join-Path $SCRIPT:WorkspaceFolder 'debug' log "Prebuilding PowerShell for Codespaces to $outputPath" - Start-PSBuild -UseNugetOrg -Clean -Output $outputPath - + Start-PSBuild -UseNugetOrg -Clean log 'Prebuilding Tests' dotnet build test/xUnit test/Modules } diff --git a/.vscode/launch.json b/.vscode/launch.json index c932620bfe8..79907453fe9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,6 +8,7 @@ "program": "${workspaceRoot}/debug/pwsh", "console": "integratedTerminal", "justMyCode": false, + "stopAtEntry": false, "preLaunchTask": "Build", "cwd": "${workspaceRoot}" }, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 02bebf7736c..0d29b2041da 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -39,9 +39,9 @@ "tasks": [ { - "label": "Build", + "label": "Build - Clean", "type": "shell", - "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBuild -Output (Join-Path '${workspaceFolder}' debug)", + "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBuild -Clean", "group": { "kind": "build", "isDefault": true @@ -49,9 +49,9 @@ "problemMatcher": "$msCompile" }, { - "label": "Build - Clean", + "label": "Build", "type": "shell", - "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBuild -Clean -Output (Join-Path '${workspaceFolder}' debug)", + "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBuild", "group": { "kind": "build", }, @@ -60,7 +60,7 @@ { "label": "Bootstrap", "type": "shell", - "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBootstrap", + "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBootstrap -Scenario dotnet", "problemMatcher": [] }, { @@ -77,7 +77,7 @@ { "label": "Test - Pester", "type": "shell", - "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSPester -powershell '${workspaceFolder}/debug'", + "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSPester", "group": { "kind": "test", }, From 59286fb27c4cbdf73e6fe3a715065241c72bc742 Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 10 May 2025 06:38:11 +0000 Subject: [PATCH 03/22] Add debug symbolic link to enable easy access to published image --- .devcontainer/scripts/1-onCreate.ps1 | 1 + .devcontainer/scripts/2-updateContent.ps1 | 23 +++++++++++++++++++++-- .gitignore | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.devcontainer/scripts/1-onCreate.ps1 b/.devcontainer/scripts/1-onCreate.ps1 index 6649654797a..fa70edc7ae9 100644 --- a/.devcontainer/scripts/1-onCreate.ps1 +++ b/.devcontainer/scripts/1-onCreate.ps1 @@ -1,5 +1,6 @@ #Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts . $PSScriptRoot/shared.ps1 +Import-Module -Force ./build.psm1 log "Adding $SCRIPT:WorkspaceFolder to git safe directories" git config --global --add safe.directory $SCRIPT:WorkspaceFolder diff --git a/.devcontainer/scripts/2-updateContent.ps1 b/.devcontainer/scripts/2-updateContent.ps1 index f37576feafb..46af86dc7d0 100644 --- a/.devcontainer/scripts/2-updateContent.ps1 +++ b/.devcontainer/scripts/2-updateContent.ps1 @@ -1,5 +1,6 @@ #Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts . $PSScriptRoot/shared.ps1 +Import-Module -Force ./build.psm1 #If doing a clone into devcontainer, VSCode defaults to a shallow clone. The build process does not support shallow #clones due to the use of git tag describe, so we must "unshallow" it if this occurs @@ -9,11 +10,10 @@ if ((git rev-parse --is-shallow-repository) -ne 'false') { } # Fetch upstream tags. The PowerShell dotnet restore requires this (GetPSCoreVersionFromGit) -Import-Module -Force ./build.psm1 Sync-PSTags -AddRemoteIfMissing log 'Bootstrap PowerShell Build Prerequisites' -Import-Module -Force ./build.psm1 + Start-PSBootstrap -Scenario DotNet #Ping is needed for tests but is not included in the .NET SDK devcontainer and PSBootstrap doesn't cover it @@ -27,3 +27,22 @@ if ($ENV:CODESPACES) { log 'Prebuilding Tests' dotnet build test/xUnit test/Modules } + +#Create a symbolic link from "debug" in the root folder to the publish folder for convenience. +$publishPath = Split-Path (get-psoptions -DefaultToNew).Output +if (-not $publishPath) { + New-Item -Path $publishPath -ItemType Directory -Force | Out-Null +} +$debugPath = Join-Path $PWD 'debug' +if (-not ( + (Test-Path $debugPath) -and + ((Get-Item $debugPath).LinkTarget -eq $publishPath) + )) { + #Remove the old link if it exists + if (Test-Path $debugPath) { + log "Removing existing debug symbolic link at $debugPath" + Remove-Item $debugPath -Force + } + log "Creating convenience link from $debugPath to $publishPath" + ln -s $publishPath $debugPath +} diff --git a/.gitignore b/.gitignore index ccadde27182..8163add2aec 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ obj/ project.lock.json *-tests.xml /debug/ +/debug /staging/ /Packages/ *.nuget.props From 0916b2b1f5d5a2b1af41f94d28ba6cf5d17b00e0 Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 10 May 2025 07:02:12 +0000 Subject: [PATCH 04/22] Remove PrelaunchTask requirement for debug --- .vscode/launch.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 79907453fe9..01e50969fc4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,14 +2,13 @@ "version": "0.2.0", "configurations": [ { - "name": ".NET Core Launch", + "name": "PowerShell Dev Console", "type": "coreclr", "request": "launch", "program": "${workspaceRoot}/debug/pwsh", "console": "integratedTerminal", "justMyCode": false, "stopAtEntry": false, - "preLaunchTask": "Build", "cwd": "${workspaceRoot}" }, { From 6e24c4b7f7a68ee78333fdff3e696cf90c29de4e Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Mon, 12 May 2025 20:06:09 +0000 Subject: [PATCH 05/22] Add debug symlink to poststart --- .devcontainer/devcontainer.json | 2 +- .devcontainer/scripts/4-postStart.ps1 | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 861cf46a394..cfdff5a08e1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -35,7 +35,7 @@ // These lifecycle scripts are non-blocking to loading the codespace and UI by default // "postCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/3-postCreate.ps1"], - // "postStartCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/4-postStart.ps1"], + "postStartCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/4-postStart.ps1"], // "postAttachCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/5-postAttach.ps1"], // Configure tool-specific properties. diff --git a/.devcontainer/scripts/4-postStart.ps1 b/.devcontainer/scripts/4-postStart.ps1 index 945161a2970..093aacd6956 100644 --- a/.devcontainer/scripts/4-postStart.ps1 +++ b/.devcontainer/scripts/4-postStart.ps1 @@ -1 +1,23 @@ #Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts + +. $PSScriptRoot/shared.ps1 +Import-Module -Force ./build.psm1 + +#Create a symbolic link from "debug" in the root folder to the publish folder for convenience. +$publishPath = Split-Path (get-psoptions -DefaultToNew).Output +if (-not $publishPath) { + New-Item -Path $publishPath -ItemType Directory -Force | Out-Null +} +$debugPath = Join-Path $PWD 'debug' +if (-not ( + (Test-Path $debugPath) -and + ((Get-Item $debugPath).LinkTarget -eq $publishPath) + )) { + #Remove the old link if it exists + if (Test-Path $debugPath) { + log "Removing existing debug symbolic link at $debugPath" + Remove-Item $debugPath -Force + } + log "Creating convenience link from $debugPath to $publishPath" + New-Item -ItemType SymbolicLink -Value $publishPath -Path $debugPath +} From 6e3f10a7298981bc78eb1d50b51cd48172f9cebf Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Fri, 16 May 2025 16:54:40 +0000 Subject: [PATCH 06/22] Convert to Dockerfile based devcontainer to embed startup scripts This is a workaround for https://github.com/microsoft/vscode-remote-release/issues/10934 --- .devcontainer/Dockerfile | 5 ++++ .devcontainer/devcontainer.json | 35 ++++++++++++----------- .devcontainer/scripts/2-updateContent.ps1 | 7 ++++- 3 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000000..1d1457571c9 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,5 @@ +ARG VARIANT=preview +FROM mcr.microsoft.com/devcontainers/dotnet:${VARIANT} + +# This is a workaround for https://github.com/microsoft/vscode-remote-release/issues/10934 +ADD ./scripts /devcontainer/scripts \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index cfdff5a08e1..fec051ba7be 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,18 +1,20 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/dotnet { - "name": "PowerShell Development", - // NOTE: This should be kept up to date to match the .NET SDK currently in use on the master branch. - // but not mandatory as we fetch the appropriate .NET SDK as needed during build. - "image": "mcr.microsoft.com/devcontainers/dotnet:1-10.0-preview-noble", + "name": "JG PowerShell", + + "build": { + "dockerfile": "Dockerfile", + "args": { + // NOTE: This should be kept up to date to match the .NET SDK currently in use on the master branch. + // but not mandatory as we fetch the appropriate .NET SDK as needed during build. + // See: https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/dotnet/tags for available tags. + "VARIANT": "1-10.0-preview-noble" + } + }, "hostRequirements": { "cpus": 4 }, - - // Bind the working folder to /powershell instead of /workspaces/PowerShell - "workspaceMount": "source=${localWorkspaceFolder},target=/powershell,type=bind,consistency=cached", - "workspaceFolder": "/powershell", - "capAdd": [ "NET_RAW" // Needed for Pester tests that require ping ], @@ -29,14 +31,15 @@ // Container lifecycle scripts // Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts - //NOTE: We don't use initializeCommand because that runs on the host and we may not know what OS it is. - "onCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/1-onCreate.ps1"], - "updateContentCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/2-updateContent.ps1"], + // NOTE: We don't use initializeCommand because that runs on the host and we may not know what OS it is. + + "onCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/1-onCreate.ps1"], + "updateContentCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/2-updateContent.ps1"], // These lifecycle scripts are non-blocking to loading the codespace and UI by default - // "postCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/3-postCreate.ps1"], - "postStartCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/4-postStart.ps1"], - // "postAttachCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", ".devcontainer/scripts/5-postAttach.ps1"], + "postCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/3-postCreate.ps1"], + "postStartCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/4-postStart.ps1"], + "postAttachCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/5-postAttach.ps1"], // Configure tool-specific properties. "customizations": { @@ -47,7 +50,7 @@ "csharp.experimental.debug.hotReload": true, "powershell.powerShellAdditionalExePaths": { "PowerShell-Devcontainer": "/usr/bin/pwsh", - "PowerShell-DevBuild": "/powershell/debug/pwsh" + "PowerShell-DevBuild": "${workspaceFolder}/debug/pwsh" }, "powershell.powerShellDefaultVersion": "PowerShell-Devcontainer", "terminal.integrated.defaultProfile.linux": "pwsh", diff --git a/.devcontainer/scripts/2-updateContent.ps1 b/.devcontainer/scripts/2-updateContent.ps1 index 46af86dc7d0..ebaccc0dc01 100644 --- a/.devcontainer/scripts/2-updateContent.ps1 +++ b/.devcontainer/scripts/2-updateContent.ps1 @@ -25,7 +25,12 @@ if ($ENV:CODESPACES) { log "Prebuilding PowerShell for Codespaces to $outputPath" Start-PSBuild -UseNugetOrg -Clean log 'Prebuilding Tests' - dotnet build test/xUnit test/Modules + dotnet build test/xUnit + log 'Fetching Pester for Tests' + Restore-PSPester + log 'Build Testing Tools' + Publish-PSTestTools + Publish-CustomConnectionTestModule } #Create a symbolic link from "debug" in the root folder to the publish folder for convenience. From b3e68d3d55c01e7db43c1504a41cda9f54a287a9 Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Fri, 16 May 2025 10:15:36 -0700 Subject: [PATCH 07/22] Supress progress cluttering the codespaces prebuild logs --- .devcontainer/scripts/1-onCreate.ps1 | 3 +++ .devcontainer/scripts/2-updateContent.ps1 | 3 +++ .devcontainer/scripts/4-postStart.ps1 | 2 ++ 3 files changed, 8 insertions(+) diff --git a/.devcontainer/scripts/1-onCreate.ps1 b/.devcontainer/scripts/1-onCreate.ps1 index fa70edc7ae9..68c4420bb9f 100644 --- a/.devcontainer/scripts/1-onCreate.ps1 +++ b/.devcontainer/scripts/1-onCreate.ps1 @@ -1,4 +1,7 @@ #Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts +$ErrorActionPreference = 'Stop' +$ProgressPreference = 'SilentlyContinue' + . $PSScriptRoot/shared.ps1 Import-Module -Force ./build.psm1 diff --git a/.devcontainer/scripts/2-updateContent.ps1 b/.devcontainer/scripts/2-updateContent.ps1 index ebaccc0dc01..b28652b3216 100644 --- a/.devcontainer/scripts/2-updateContent.ps1 +++ b/.devcontainer/scripts/2-updateContent.ps1 @@ -1,4 +1,7 @@ #Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts +$ErrorActionPreference = 'Stop' +$ProgressPreference = 'SilentlyContinue' + . $PSScriptRoot/shared.ps1 Import-Module -Force ./build.psm1 diff --git a/.devcontainer/scripts/4-postStart.ps1 b/.devcontainer/scripts/4-postStart.ps1 index 093aacd6956..81611b95814 100644 --- a/.devcontainer/scripts/4-postStart.ps1 +++ b/.devcontainer/scripts/4-postStart.ps1 @@ -1,4 +1,6 @@ #Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts +$ErrorActionPreference = 'Stop' +$ProgressPreference = 'SilentlyContinue' . $PSScriptRoot/shared.ps1 Import-Module -Force ./build.psm1 From d577ec3fcbe6bbf27926d5be11f272f67066fc1d Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 16 May 2025 18:28:46 +0000 Subject: [PATCH 08/22] Revise tasks to use the shell at the default pwsh path (to allow customization) --- .vscode/tasks.json | 43 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 0d29b2041da..89ed50ae618 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,42 +1,15 @@ { "version": "2.0.0", - - "windows": { - "options": { - "shell": { - "executable": "pwsh.exe", - "args": [ - "-NoProfile", - "-ExecutionPolicy", - "Bypass", - "-Command" - ] - } - } - }, - "linux": { - "options": { - "shell": { - "executable": "/usr/bin/pwsh", - "args": [ - "-NoProfile", - "-Command" - ] - } + "options": { + "shell": { + "executable": "pwsh", + "args": [ + "-NoProfile", + "-NonInteractive", + "-Command" + ] } }, - "osx": { - "options": { - "shell": { - "executable": "/usr/local/bin/pwsh", - "args": [ - "-NoProfile", - "-Command" - ] - } - } - }, - "tasks": [ { "label": "Build - Clean", From 4583361905e99e4c841ca2de8e202f78e01a73b0 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 16 May 2025 19:04:10 +0000 Subject: [PATCH 09/22] More terminal fixes --- .devcontainer/devcontainer.json | 13 +++++++++---- .devcontainer/scripts/2-updateContent.ps1 | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fec051ba7be..3d5792adcf9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,7 @@ "dockerfile": "Dockerfile", "args": { // NOTE: This should be kept up to date to match the .NET SDK currently in use on the master branch. - // but not mandatory as we fetch the appropriate .NET SDK as needed during build. + // but not mandatory as we fetch the appropriate .NET SDK as needed during build. // See: https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/dotnet/tags for available tags. "VARIANT": "1-10.0-preview-noble" } @@ -19,6 +19,10 @@ "NET_RAW" // Needed for Pester tests that require ping ], + // This is symlinked in the onCreateCommand to the actual workspaceFolder but is used for consistency. + // Note that this is ignored when using a named volume devcontainer but will still work fine. + "workspaceFolder": "/powershell", + "remoteUser": "vscode", "containerUser": "vscode", @@ -32,14 +36,15 @@ // Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts // NOTE: We don't use initializeCommand because that runs on the host and we may not know what OS it is. - "onCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/1-onCreate.ps1"], "updateContentCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/2-updateContent.ps1"], // These lifecycle scripts are non-blocking to loading the codespace and UI by default "postCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/3-postCreate.ps1"], "postStartCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/4-postStart.ps1"], - "postAttachCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/5-postAttach.ps1"], + + // This runs in a vscode terminal after startup and is generally not needed but here for reference. + // "postAttachCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/5-postAttach.ps1"], // Configure tool-specific properties. "customizations": { @@ -53,7 +58,7 @@ "PowerShell-DevBuild": "${workspaceFolder}/debug/pwsh" }, "powershell.powerShellDefaultVersion": "PowerShell-Devcontainer", - "terminal.integrated.defaultProfile.linux": "pwsh", + // "terminal.integrated.defaultProfile.linux": "pwsh", "terminal.integrated.profiles.linux": { "pwsh dev": { "path": "${workspaceFolder}/debug/pwsh", diff --git a/.devcontainer/scripts/2-updateContent.ps1 b/.devcontainer/scripts/2-updateContent.ps1 index b28652b3216..c43503153f3 100644 --- a/.devcontainer/scripts/2-updateContent.ps1 +++ b/.devcontainer/scripts/2-updateContent.ps1 @@ -37,6 +37,7 @@ if ($ENV:CODESPACES) { } #Create a symbolic link from "debug" in the root folder to the publish folder for convenience. +#This is required because some settings like terminal.integrated.profiles.linux cannot use variables like ${workspaceFolder} so we need an absolute path. $publishPath = Split-Path (get-psoptions -DefaultToNew).Output if (-not $publishPath) { New-Item -Path $publishPath -ItemType Directory -Force | Out-Null From 1bb7e39d4dbc0bddd021a74353e069523aede874 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 16 May 2025 19:46:54 +0000 Subject: [PATCH 10/22] Fix debug pwsh to use absolute path --- .devcontainer/devcontainer.json | 158 +++++++++++++++++++------------- 1 file changed, 92 insertions(+), 66 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3d5792adcf9..62c33ef871a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,79 +1,105 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/dotnet { - "name": "JG PowerShell", + "name": "JG PowerShell", - "build": { - "dockerfile": "Dockerfile", - "args": { - // NOTE: This should be kept up to date to match the .NET SDK currently in use on the master branch. - // but not mandatory as we fetch the appropriate .NET SDK as needed during build. - // See: https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/dotnet/tags for available tags. - "VARIANT": "1-10.0-preview-noble" - } - }, - "hostRequirements": { - "cpus": 4 - }, - "capAdd": [ - "NET_RAW" // Needed for Pester tests that require ping - ], + "build": { + "dockerfile": "Dockerfile", + "args": { + // NOTE: This should be kept up to date to match the .NET SDK currently in use on the master branch. + // but not mandatory as we fetch the appropriate .NET SDK as needed during build. + // See: https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/dotnet/tags for available tags. + "VARIANT": "1-10.0-preview-noble" + } + }, + "hostRequirements": { + "cpus": 4 // .NET compliation is intensive so we want more cores by default + }, + "capAdd": [ + "NET_RAW" // Needed for Pester tests that require ping + ], - // This is symlinked in the onCreateCommand to the actual workspaceFolder but is used for consistency. - // Note that this is ignored when using a named volume devcontainer but will still work fine. - "workspaceFolder": "/powershell", + // This path is symlinked in the onCreateCommand to the actual workspaceFolder + // We use it for convenience and consistency with the settings that require absolute paths. + // NOTE: This is ignored when using a named volume devcontainer but will still work fine. + "workspaceFolder": "/powershell", - "remoteUser": "vscode", - "containerUser": "vscode", + "remoteUser": "vscode", + "containerUser": "vscode", - // This is required if the dotnet is updated to a later version than what is in the image. - // So that the C# extension can detect it. Doing it in .bashrc is not enough. - "remoteEnv": { - "PATH": "/home/vscode/.dotnet:${containerEnv:PATH}" - }, + // This is required if the dotnet is updated to a later version than what is in the image. + // So that the C# extension can detect it. Doing it in .bashrc is not enough. + "remoteEnv": { + "PATH": "/home/vscode/.dotnet:${containerEnv:PATH}" + }, - // Container lifecycle scripts - // Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts + // Container lifecycle scripts + // Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts - // NOTE: We don't use initializeCommand because that runs on the host and we may not know what OS it is. - "onCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/1-onCreate.ps1"], - "updateContentCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/2-updateContent.ps1"], + // NOTE: We don't use initializeCommand because that runs on the host and we may not know what OS it is. + "onCreateCommand": [ + "/usr/bin/pwsh", + "-nop", + "-noni", + "-f", + "/devcontainer/scripts/1-onCreate.ps1" + ], + "updateContentCommand": [ + "/usr/bin/pwsh", + "-nop", + "-noni", + "-f", + "/devcontainer/scripts/2-updateContent.ps1" + ], - // These lifecycle scripts are non-blocking to loading the codespace and UI by default - "postCreateCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/3-postCreate.ps1"], - "postStartCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/4-postStart.ps1"], + // These lifecycle scripts are non-blocking to loading the codespace and UI by default + "postCreateCommand": [ + "/usr/bin/pwsh", + "-nop", + "-noni", + "-f", + "/devcontainer/scripts/3-postCreate.ps1" + ], + "postStartCommand": [ + "/usr/bin/pwsh", + "-nop", + "-noni", + "-f", + "/devcontainer/scripts/4-postStart.ps1" + ], - // This runs in a vscode terminal after startup and is generally not needed but here for reference. - // "postAttachCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/5-postAttach.ps1"], + // This runs in a vscode terminal after startup and is generally not needed but here for reference. + // "postAttachCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/5-postAttach.ps1"], - // Configure tool-specific properties. - "customizations": { - "vscode": { - "settings": { - "dotnet.defaultSolution": "PowerShell.sln", - "dotnet.testWindow.useTestingPlatformProtocol": true, - "csharp.experimental.debug.hotReload": true, - "powershell.powerShellAdditionalExePaths": { - "PowerShell-Devcontainer": "/usr/bin/pwsh", - "PowerShell-DevBuild": "${workspaceFolder}/debug/pwsh" - }, - "powershell.powerShellDefaultVersion": "PowerShell-Devcontainer", - // "terminal.integrated.defaultProfile.linux": "pwsh", - "terminal.integrated.profiles.linux": { - "pwsh dev": { - "path": "${workspaceFolder}/debug/pwsh", - "icon": "terminal-powershell", - "color": "terminal.ansiMagenta" - } - } - }, - "extensions": [ - "ms-dotnettools.csharp", - "ms-dotnettools.csdevkit", //Free for open source projects - "ms-vscode.PowerShell", - "ms-azure-devops.azure-pipelines", - "github.vscode-pull-request-github" - ] - } - } + // Configure tool-specific properties. + "customizations": { + "vscode": { + "settings": { + "dotnet.defaultSolution": "PowerShell.sln", + "dotnet.testWindow.useTestingPlatformProtocol": true, + "csharp.experimental.debug.hotReload": true, + "powershell.powerShellAdditionalExePaths": { + "PowerShell-Devcontainer": "/usr/bin/pwsh", + "PowerShell-DevBuild": "${workspaceFolder}/debug/pwsh" + }, + "powershell.powerShellDefaultVersion": "PowerShell-Devcontainer", + "terminal.integrated.defaultProfile.linux": "pwsh", + "terminal.integrated.profiles.linux": { + "pwsh dev": { + "path": "/powershell/debug/pwsh", + "icon": "terminal-powershell", + "color": "terminal.ansiMagenta" + } + } + }, + "extensions": [ + "ms-dotnettools.csharp", + "ms-dotnettools.csdevkit", + "ms-vscode.PowerShell", + "ms-azure-devops.azure-pipelines", + "github.vscode-pull-request-github", + "esbenp.prettier-vscode" + ] + } + } } From b5e94bf6c5700f8439505f0d96dc0a442acde09e Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 16 May 2025 19:47:26 +0000 Subject: [PATCH 11/22] Update default formatters for various languages --- .vscode/extensions.json | 3 ++- .vscode/settings.json | 27 ++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index fa227cd9944..f2fe47ad6bb 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -9,6 +9,7 @@ "ms-vscode.PowerShell", "twxs.cmake", "DavidAnson.vscode-markdownlint", - "vitaliymaz.vscode-svg-previewer" + "vitaliymaz.vscode-svg-previewer", + "esbenp.prettier-vscode" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index ad298823d10..67dab9b3356 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,10 +1,30 @@ // Place your settings in this file to overwrite default and user settings. { + // This is the default. EditorConfig *should* override this on a per language basis. "editor.tabSize": 4, "editor.insertSpaces": true, - "files.insertFinalNewline": true, + // These are defaults but explicitly specified to override any user local preferences + "omnisharp.enableEditorConfigSupport": true, + "prettier.useEditorConfig": true, + "editor.formatOnSave": true, + "editor.formatOnPaste": true, + + // Only format changed code, as lots of code may not meet current format standards. + "editor.formatOnSaveMode": "modifications", + + // We leave this one up to the user + // "editor.codeActionsOnSave": {} + + // Configure Prettier for formatting + // PowerShell and C# use their respective extension formatters + // Markdown uses markdownlint + "[json][jsonc][yaml][shellscript][html][javascript][typescript][properties]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + // Markdown + // Based on current .markdownlist.json settings: // https://github.com/PowerShell/PowerShell/blob/master/.markdownlint.json "markdownlint.config": { @@ -33,8 +53,5 @@ "powershell.codeFormatting.whitespaceAroundOperator": true, // Adds a space after a separator (',' and ';'). - "powershell.codeFormatting.whitespaceAfterSeparator": true, - - // Omnisharp : Enable EditorConfig support - "omnisharp.enableEditorConfigSupport": true + "powershell.codeFormatting.whitespaceAfterSeparator": true } From b1211f1461b1eb8bc730522ea460e2a92d9c308b Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 16 May 2025 19:47:41 +0000 Subject: [PATCH 12/22] Remove typo --- .vscode/settings.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 67dab9b3356..c85666d7538 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,7 +23,6 @@ "[json][jsonc][yaml][shellscript][html][javascript][typescript][properties]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, - // Markdown // Based on current .markdownlist.json settings: // https://github.com/PowerShell/PowerShell/blob/master/.markdownlint.json From d5db1e734bffc53c3867d5019278df7918dc62a4 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 16 May 2025 21:14:23 +0000 Subject: [PATCH 13/22] Add back workspacemount to account for codespaces --- .devcontainer/devcontainer.json | 2 +- .devcontainer/scripts/1-onCreate.ps1 | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 62c33ef871a..5e1ce2e5f9d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,6 +23,7 @@ // We use it for convenience and consistency with the settings that require absolute paths. // NOTE: This is ignored when using a named volume devcontainer but will still work fine. "workspaceFolder": "/powershell", + "workspaceMount": "source=${localWorkspaceFolder},target=/powershell,type=bind,consistency=cached", "remoteUser": "vscode", "containerUser": "vscode", @@ -83,7 +84,6 @@ "PowerShell-DevBuild": "${workspaceFolder}/debug/pwsh" }, "powershell.powerShellDefaultVersion": "PowerShell-Devcontainer", - "terminal.integrated.defaultProfile.linux": "pwsh", "terminal.integrated.profiles.linux": { "pwsh dev": { "path": "/powershell/debug/pwsh", diff --git a/.devcontainer/scripts/1-onCreate.ps1 b/.devcontainer/scripts/1-onCreate.ps1 index 68c4420bb9f..9f2783c2ec4 100644 --- a/.devcontainer/scripts/1-onCreate.ps1 +++ b/.devcontainer/scripts/1-onCreate.ps1 @@ -17,8 +17,6 @@ if (-not (Test-Path $defaultWorkspaceFolder)) { git config --global --add safe.directory $defaultWorkspaceFolder } - - # NOTE: We override the Azure Devops private feed as it may not be up to date with the required packages # This is only for development and not builds so any potential vulnerabilities will be caught at CI time # If you want to restore private restore behavior for testing, perform the following: From 16240584b6c7af02664f3ada63683789211b17a6 Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 17 May 2025 15:06:10 +0000 Subject: [PATCH 14/22] Build: Add `-PublishLinkPath` to `Start-PSBuild` Enables tooling such as vscode to have a stable path to locate a debug build of PowerShell --- build.psm1 | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index 34d79670fb4..8d81bc88a46 100644 --- a/build.psm1 +++ b/build.psm1 @@ -341,7 +341,9 @@ function Start-PSBuild { [switch]$Detailed, [switch]$InteractiveAuth, [switch]$SkipRoslynAnalyzers, - [string]$PSOptionsPath + [string]$PSOptionsPath, + # When specified, a symbolic link to the pwsh publish directory will be created to the resultant publish directory. This is helpful for tools that require a stable path to the pwsh executable. + [string]$PublishLinkPath ) if ($ReleaseTag -and $ReleaseTag -notmatch "^v\d+\.\d+\.\d+(-(preview|rc)(\.\d{1,2})?)?$") { @@ -610,6 +612,33 @@ Fix steps: Pop-Location } + if ($PublishLinkPath -and (Test-Path $publishPath)) { + $linkPath = Join-Path $PSScriptRoot $PublishLinkPath + try { + if (Test-Path $linkPath) { + if (-not ((Get-Item $linkPath).LinkType -eq 'SymbolicLink')) { + throw "PublishLinkPath specified but $linkPath exists and is not a symbolic link. Please remove it manually." + } + + $linkTarget = (Get-Item $linkPath).Target + if ($linkTarget -ne $publishPath) { + Write-Log -message "Removing existing symbolic link at $linkPath, which points to $linkTarget instead of $publishPath" + Remove-Item -Force $linkPath -ErrorAction Stop + } else { + Write-Log -message "PublishLinkPath $linkPath already points to $publishPath. Nothing to do." + } + } + + if (-not (Test-Path $linkPath)) { + Write-Log -message "Creating symbolic link at $linkPath to $publishPath" + New-Item -Force -ItemType SymbolicLink -Target $publishPath -Path $linkPath -ErrorAction Stop + } + } catch { + Write-Warning "Failed to create PublishLinkPath at $linkPath`: $_. If on Windows, ensure you are in Developer Mode" + return + } + } + # No extra post-building task will run if '-SMAOnly' is specified, because its purpose is for a quick update of S.M.A.dll after full build. if ($SMAOnly) { return From dcc1fdd7750e8f3076ac5d7610e22a54923d69eb Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 17 May 2025 15:07:44 +0000 Subject: [PATCH 15/22] Better symbolic linking to deal with named volumes etc. --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 11 ++------- .devcontainer/scripts/1-onCreate.ps1 | 18 +++++++------- .devcontainer/scripts/2-updateContent.ps1 | 29 +++++------------------ .devcontainer/scripts/4-postStart.ps1 | 24 ------------------- 5 files changed, 18 insertions(+), 66 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 1d1457571c9..2652b5c2fbb 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -2,4 +2,4 @@ ARG VARIANT=preview FROM mcr.microsoft.com/devcontainers/dotnet:${VARIANT} # This is a workaround for https://github.com/microsoft/vscode-remote-release/issues/10934 -ADD ./scripts /devcontainer/scripts \ No newline at end of file +ADD ./scripts /devcontainer/scripts diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5e1ce2e5f9d..10f127aee6a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,6 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/dotnet { "name": "JG PowerShell", - "build": { "dockerfile": "Dockerfile", "args": { @@ -22,9 +21,6 @@ // This path is symlinked in the onCreateCommand to the actual workspaceFolder // We use it for convenience and consistency with the settings that require absolute paths. // NOTE: This is ignored when using a named volume devcontainer but will still work fine. - "workspaceFolder": "/powershell", - "workspaceMount": "source=${localWorkspaceFolder},target=/powershell,type=bind,consistency=cached", - "remoteUser": "vscode", "containerUser": "vscode", @@ -68,7 +64,6 @@ "-f", "/devcontainer/scripts/4-postStart.ps1" ], - // This runs in a vscode terminal after startup and is generally not needed but here for reference. // "postAttachCommand": ["/usr/bin/pwsh", "-nop", "-noni", "-f", "/devcontainer/scripts/5-postAttach.ps1"], @@ -80,13 +75,11 @@ "dotnet.testWindow.useTestingPlatformProtocol": true, "csharp.experimental.debug.hotReload": true, "powershell.powerShellAdditionalExePaths": { - "PowerShell-Devcontainer": "/usr/bin/pwsh", - "PowerShell-DevBuild": "${workspaceFolder}/debug/pwsh" + "PowerShell-Dev": "${workspaceFolder}/debug/pwsh" }, - "powershell.powerShellDefaultVersion": "PowerShell-Devcontainer", "terminal.integrated.profiles.linux": { "pwsh dev": { - "path": "/powershell/debug/pwsh", + "path": "${workspaceFolder}/debug/pwsh", "icon": "terminal-powershell", "color": "terminal.ansiMagenta" } diff --git a/.devcontainer/scripts/1-onCreate.ps1 b/.devcontainer/scripts/1-onCreate.ps1 index 9f2783c2ec4..07dfff8919d 100644 --- a/.devcontainer/scripts/1-onCreate.ps1 +++ b/.devcontainer/scripts/1-onCreate.ps1 @@ -2,20 +2,20 @@ $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' +# The workspace folder name can be variable, we need a stable target for some settings like terminal path +$absolutePath = '/powershell' . $PSScriptRoot/shared.ps1 -Import-Module -Force ./build.psm1 + +if ($PWD -ne $absolutePath) { + log "Linking $SCRIPT:WorkspaceFolder to $absolutePath" + sudo ln -s $SCRIPT:WorkspaceFolder /powershell + log "Adding $absolutePath to git safe directories" + git config --global --add safe.directory $absolutePath +} log "Adding $SCRIPT:WorkspaceFolder to git safe directories" git config --global --add safe.directory $SCRIPT:WorkspaceFolder -# WorkspaceFolder might end up as a different path, so link it if it is not -# This is so any scripts that require a hardcoded path to the workspace folder can use it -$defaultWorkspaceFolder = '/powershell' -if (-not (Test-Path $defaultWorkspaceFolder)) { - log "Linking $defaultWorkspaceFolder to $SCRIPT:WorkspaceFolder" - & sudo ln -s $SCRIPT:WorkspaceFolder $defaultWorkspaceFolder - git config --global --add safe.directory $defaultWorkspaceFolder -} # NOTE: We override the Azure Devops private feed as it may not be up to date with the required packages # This is only for development and not builds so any potential vulnerabilities will be caught at CI time diff --git a/.devcontainer/scripts/2-updateContent.ps1 b/.devcontainer/scripts/2-updateContent.ps1 index c43503153f3..499e30a3d2f 100644 --- a/.devcontainer/scripts/2-updateContent.ps1 +++ b/.devcontainer/scripts/2-updateContent.ps1 @@ -13,6 +13,7 @@ if ((git rev-parse --is-shallow-repository) -ne 'false') { } # Fetch upstream tags. The PowerShell dotnet restore requires this (GetPSCoreVersionFromGit) +log 'Syncing PowerShell Git Tags from Remote' Sync-PSTags -AddRemoteIfMissing log 'Bootstrap PowerShell Build Prerequisites' @@ -23,10 +24,12 @@ Start-PSBootstrap -Scenario DotNet log 'Installing iputils (for the ping utility)' sudo apt install iputils-ping -y -# Perform a build if Github Codespaces prebuild, otherwise optimize to start quickly +# Perform an initial build of PowerShell, this is needed so the "pwsh dev" terminal and debug launch tasks are available on first run +log "Building PowerShell" +Start-PSBuild -UseNugetOrg -Clean -PublishLinkPath $SCRIPT:WorkspaceFolder/debug + +# Prebuild more if in a codespace, otherwise leave this to the user to optimize local startup time if ($ENV:CODESPACES) { - log "Prebuilding PowerShell for Codespaces to $outputPath" - Start-PSBuild -UseNugetOrg -Clean log 'Prebuilding Tests' dotnet build test/xUnit log 'Fetching Pester for Tests' @@ -35,23 +38,3 @@ if ($ENV:CODESPACES) { Publish-PSTestTools Publish-CustomConnectionTestModule } - -#Create a symbolic link from "debug" in the root folder to the publish folder for convenience. -#This is required because some settings like terminal.integrated.profiles.linux cannot use variables like ${workspaceFolder} so we need an absolute path. -$publishPath = Split-Path (get-psoptions -DefaultToNew).Output -if (-not $publishPath) { - New-Item -Path $publishPath -ItemType Directory -Force | Out-Null -} -$debugPath = Join-Path $PWD 'debug' -if (-not ( - (Test-Path $debugPath) -and - ((Get-Item $debugPath).LinkTarget -eq $publishPath) - )) { - #Remove the old link if it exists - if (Test-Path $debugPath) { - log "Removing existing debug symbolic link at $debugPath" - Remove-Item $debugPath -Force - } - log "Creating convenience link from $debugPath to $publishPath" - ln -s $publishPath $debugPath -} diff --git a/.devcontainer/scripts/4-postStart.ps1 b/.devcontainer/scripts/4-postStart.ps1 index 81611b95814..945161a2970 100644 --- a/.devcontainer/scripts/4-postStart.ps1 +++ b/.devcontainer/scripts/4-postStart.ps1 @@ -1,25 +1 @@ #Docs: https://containers.dev/implementors/json_reference/#lifecycle-scripts -$ErrorActionPreference = 'Stop' -$ProgressPreference = 'SilentlyContinue' - -. $PSScriptRoot/shared.ps1 -Import-Module -Force ./build.psm1 - -#Create a symbolic link from "debug" in the root folder to the publish folder for convenience. -$publishPath = Split-Path (get-psoptions -DefaultToNew).Output -if (-not $publishPath) { - New-Item -Path $publishPath -ItemType Directory -Force | Out-Null -} -$debugPath = Join-Path $PWD 'debug' -if (-not ( - (Test-Path $debugPath) -and - ((Get-Item $debugPath).LinkTarget -eq $publishPath) - )) { - #Remove the old link if it exists - if (Test-Path $debugPath) { - log "Removing existing debug symbolic link at $debugPath" - Remove-Item $debugPath -Force - } - log "Creating convenience link from $debugPath to $publishPath" - New-Item -ItemType SymbolicLink -Value $publishPath -Path $debugPath -} From 37e354efc8508900739c2743e723bdac4c4b4b4a Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 17 May 2025 15:22:41 +0000 Subject: [PATCH 16/22] Fix target and swallow output object --- build.psm1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index 8d81bc88a46..3721e18a2ad 100644 --- a/build.psm1 +++ b/build.psm1 @@ -613,6 +613,7 @@ Fix steps: } if ($PublishLinkPath -and (Test-Path $publishPath)) { + $linkPath = Join-Path $PSScriptRoot $PublishLinkPath try { if (Test-Path $linkPath) { @@ -631,7 +632,10 @@ Fix steps: if (-not (Test-Path $linkPath)) { Write-Log -message "Creating symbolic link at $linkPath to $publishPath" - New-Item -Force -ItemType SymbolicLink -Target $publishPath -Path $linkPath -ErrorAction Stop + $result = New-Item -Force -ItemType SymbolicLink -Path $linkPath -Value $publishPath -ErrorAction Stop + if (-not $result) { + throw "Failed to create symbolic link at $linkPath, New-Item was run but nothing was returned. This is probably a bug." + } } } catch { Write-Warning "Failed to create PublishLinkPath at $linkPath`: $_. If on Windows, ensure you are in Developer Mode" From 9672ec7d90b89281e142e3f3edb68aea7bc56a44 Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 17 May 2025 15:27:50 +0000 Subject: [PATCH 17/22] Use relative path for debug --- .devcontainer/scripts/2-updateContent.ps1 | 2 +- .vscode/tasks.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/scripts/2-updateContent.ps1 b/.devcontainer/scripts/2-updateContent.ps1 index 499e30a3d2f..308fc39a7e0 100644 --- a/.devcontainer/scripts/2-updateContent.ps1 +++ b/.devcontainer/scripts/2-updateContent.ps1 @@ -26,7 +26,7 @@ sudo apt install iputils-ping -y # Perform an initial build of PowerShell, this is needed so the "pwsh dev" terminal and debug launch tasks are available on first run log "Building PowerShell" -Start-PSBuild -UseNugetOrg -Clean -PublishLinkPath $SCRIPT:WorkspaceFolder/debug +Start-PSBuild -UseNugetOrg -Clean -PublishLinkPath debug # Prebuild more if in a codespace, otherwise leave this to the user to optimize local startup time if ($ENV:CODESPACES) { diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 89ed50ae618..6bdfd9319b7 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -14,7 +14,7 @@ { "label": "Build - Clean", "type": "shell", - "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBuild -Clean", + "command": "Import-Module '${workspaceFolder}/build.psm1'; Start-PSBuild -Clean -PublishLinkPath debug", "group": { "kind": "build", "isDefault": true From 2ecffef7365785cbccef951d060b9915c04f5ca2 Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 17 May 2025 15:42:00 +0000 Subject: [PATCH 18/22] Absolute path to symlinked terminal --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 10f127aee6a..8819527bcb2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -79,7 +79,7 @@ }, "terminal.integrated.profiles.linux": { "pwsh dev": { - "path": "${workspaceFolder}/debug/pwsh", + "path": "/powershell/debug/pwsh", "icon": "terminal-powershell", "color": "terminal.ansiMagenta" } From f9f777cb85da43c5662fe5ff8484cf80b4de767e Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 17 May 2025 15:46:06 +0000 Subject: [PATCH 19/22] Suppress moduleload and exceptions in PowerShell Dev Console Launch Config --- .vscode/launch.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index 01e50969fc4..6d6bf3ffb72 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,6 +9,10 @@ "console": "integratedTerminal", "justMyCode": false, "stopAtEntry": false, + "logging": { + "moduleLoad": false, + "exceptions": false // PS throws a lot of caught exceptions and this clutters output view. + }, "cwd": "${workspaceRoot}" }, { From f16e7d5de6ca9dbb617625b073fddb55608797bc Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 17 May 2025 15:46:54 +0000 Subject: [PATCH 20/22] Update extensions --- .devcontainer/devcontainer.json | 4 +++- .vscode/extensions.json | 9 ++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8819527bcb2..e67b56412f2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -89,8 +89,10 @@ "ms-dotnettools.csharp", "ms-dotnettools.csdevkit", "ms-vscode.PowerShell", + "GitHub.vscode-pull-request-github", "ms-azure-devops.azure-pipelines", - "github.vscode-pull-request-github", + "editorconfig.editorconfig", + "DavidAnson.vscode-markdownlint", "esbenp.prettier-vscode" ] } diff --git a/.vscode/extensions.json b/.vscode/extensions.json index f2fe47ad6bb..ad9512dd114 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,14 +2,13 @@ // See https://go.microsoft.com/fwlink/?LinkId=827846 // for the documentation about the extensions.json format "recommendations": [ - "editorconfig.editorconfig", - "ms-azure-devops.azure-pipelines", - "ms-vscode.cpptools", "ms-dotnettools.csharp", + "ms-dotnettools.csdevkit", "ms-vscode.PowerShell", - "twxs.cmake", + "GitHub.vscode-pull-request-github", + "ms-azure-devops.azure-pipelines", + "editorconfig.editorconfig", "DavidAnson.vscode-markdownlint", - "vitaliymaz.vscode-svg-previewer", "esbenp.prettier-vscode" ] } From 8e0068fb1e29b8821965b53363869e116e0b21e9 Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 17 May 2025 15:58:21 +0000 Subject: [PATCH 21/22] Remove "JG" prefix --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e67b56412f2..bfe347e4adb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,7 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/dotnet { - "name": "JG PowerShell", + "name": "PowerShell", "build": { "dockerfile": "Dockerfile", "args": { From bd407bded23eb9536076e2efe71209fd6a07dcb9 Mon Sep 17 00:00:00 2001 From: Justin Grote <15258962+JustinGrote@users.noreply.github.com.> Date: Sat, 17 May 2025 09:27:44 -0700 Subject: [PATCH 22/22] Change name to "PowerShell Dev" --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bfe347e4adb..82d44321e0f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,7 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/dotnet { - "name": "PowerShell", + "name": "PowerShell Dev", "build": { "dockerfile": "Dockerfile", "args": {