From 5072f53db3eb70ede7d126fbba99e68524e9f4f4 Mon Sep 17 00:00:00 2001 From: bschnurr Date: Thu, 22 Jan 2026 17:55:36 -0800 Subject: [PATCH 1/4] Added template parameter enabledApiProposalsJson. Added env: EnabledApiProposalsJson: ${{ parameters.enabledApiProposalsJson }} on the PowerShell@2 step. Script continues to read $env:EnabledApiProposalsJson (safe for JSON with quotes). publish-extension.yml Wired it up: enabledApiProposalsJson: $(EnabledApiProposalsJson) when calling the publish template. This should fully eliminate the PowerShell parser failure you hit while still allowing the --allow-proposed-apis ... list to be applied when present. --- build/templates/publish-extension.yml | 1 + build/templates/publish.yml | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/build/templates/publish-extension.yml b/build/templates/publish-extension.yml index 22745256..4d8ad1a3 100644 --- a/build/templates/publish-extension.yml +++ b/build/templates/publish-extension.yml @@ -239,6 +239,7 @@ jobs: azureSubscription: ${{ parameters.azureSubscription }} buildPlatforms: ${{ parameters.buildPlatforms }} manifestName: ${{ parameters.manifestName }} + enabledApiProposalsJson: $(EnabledApiProposalsJson) signatureName: ${{ parameters.signatureName }} publishFolder: ${{ parameters.publishFolder }} preRelease: ${{ parameters.preRelease }} diff --git a/build/templates/publish.yml b/build/templates/publish.yml index dd6395ac..4a6c0a32 100644 --- a/build/templates/publish.yml +++ b/build/templates/publish.yml @@ -42,6 +42,9 @@ parameters: - name: preRelease type: boolean default: false + - name: enabledApiProposalsJson + type: string + default: '' steps: # Node & vsce expected to be prepared by parent pipeline; omit local installation. @@ -68,6 +71,8 @@ steps: - ${{ each platform in parameters.buildPlatforms }}: - task: PowerShell@2 displayName: "Publish extension (${{ coalesce(platform.vsceTarget, 'universal') }})" + env: + EnabledApiProposalsJson: ${{ parameters.enabledApiProposalsJson }} inputs: targetType: inline script: | @@ -103,8 +108,8 @@ steps: # If the extension uses proposed APIs, vsce requires explicitly allowing them. # We expect EnabledApiProposalsJson to be set by an earlier step (e.g. publish-extension.yml). $allowProposedApisArgs = @() - $enabledApiProposalsJson = "$(EnabledApiProposalsJson)" - if (-not $enabledApiProposalsJson -or ($enabledApiProposalsJson -match '^\$\(')) { + $enabledApiProposalsJson = $env:EnabledApiProposalsJson + if ([string]::IsNullOrWhiteSpace($enabledApiProposalsJson)) { Write-Host "EnabledApiProposalsJson is not set; publishing without --allow-proposed-apis." } else { try { @@ -120,9 +125,10 @@ steps: } } + $allowProposedApisDisplay = ($allowProposedApisArgs -join ' ') + if ('${{ parameters.preRelease }}' -eq 'True') { Write-Host 'Publishing as pre-release' - $allowProposedApisDisplay = ($allowProposedApisArgs -join ' ') $displayCmd = "Executing: npx @vscode/vsce@latest publish --pat *** --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath" if ($allowProposedApisDisplay) { $displayCmd += " $allowProposedApisDisplay" } $displayCmd += ' --pre-release' @@ -130,7 +136,6 @@ steps: npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath $allowProposedApisArgs --pre-release } else { Write-Host 'Publishing as stable release' - $allowProposedApisDisplay = ($allowProposedApisArgs -join ' ') $displayCmd = "Executing: npx @vscode/vsce@latest publish --pat *** --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath" if ($allowProposedApisDisplay) { $displayCmd += " $allowProposedApisDisplay" } Write-Host $displayCmd From b3ab8553add7f163f59fefc12dbe7e3738ed2a5c Mon Sep 17 00:00:00 2001 From: bschnurr Date: Thu, 22 Jan 2026 17:57:24 -0800 Subject: [PATCH 2/4] disable publish --- build/templates/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/templates/publish.yml b/build/templates/publish.yml index 4a6c0a32..8c7e6a2c 100644 --- a/build/templates/publish.yml +++ b/build/templates/publish.yml @@ -133,13 +133,13 @@ steps: if ($allowProposedApisDisplay) { $displayCmd += " $allowProposedApisDisplay" } $displayCmd += ' --pre-release' Write-Host $displayCmd - npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath $allowProposedApisArgs --pre-release + # npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath $allowProposedApisArgs --pre-release } else { Write-Host 'Publishing as stable release' $displayCmd = "Executing: npx @vscode/vsce@latest publish --pat *** --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath" if ($allowProposedApisDisplay) { $displayCmd += " $allowProposedApisDisplay" } Write-Host $displayCmd - npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath $allowProposedApisArgs + # npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath $allowProposedApisArgs } if ($LASTEXITCODE -ne 0) { From 0a6c298c42eec310bc57a644448fc1b867c739a7 Mon Sep 17 00:00:00 2001 From: bschnurr Date: Thu, 22 Jan 2026 20:15:15 -0800 Subject: [PATCH 3/4] =?UTF-8?q?The=20System.Object[]=20happened=20later,?= =?UTF-8?q?=20inside=20the=20publish=20step,=20because=20the=20publish=20s?= =?UTF-8?q?cript=20was=20turning=20the=20JSON=20into=20a=20nested=20array?= =?UTF-8?q?=20and=20then=20joining/printing=20it=20poorly=20=E2=80=94=20wh?= =?UTF-8?q?ich=20then=20produced=20an=20invalid=20CLI=20arg:=20--allow-pro?= =?UTF-8?q?posed-apis=20System.Object[].?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I’ve fixed that parsing/flattening in publish.yml, so the publish log should now show: enabledApiProposals (from EnabledApiProposalsJson): portsAttributes, debugVisualization, contribViewsWelcome and the npx ... publish command should include: --allow-proposed-apis portsAttributes debugVisualization contribViewsWelcome --- build/templates/publish.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/build/templates/publish.yml b/build/templates/publish.yml index 8c7e6a2c..f800bfe6 100644 --- a/build/templates/publish.yml +++ b/build/templates/publish.yml @@ -113,10 +113,20 @@ steps: Write-Host "EnabledApiProposalsJson is not set; publishing without --allow-proposed-apis." } else { try { - $enabledApiProposals = @($enabledApiProposalsJson | ConvertFrom-Json) + $parsedEnabledApiProposals = ConvertFrom-Json -InputObject $enabledApiProposalsJson + $enabledApiProposals = @() + + if ($null -ne $parsedEnabledApiProposals) { + foreach ($proposal in @($parsedEnabledApiProposals)) { + if (-not [string]::IsNullOrWhiteSpace([string]$proposal)) { + $enabledApiProposals += [string]$proposal + } + } + } + if ($enabledApiProposals.Count -gt 0) { Write-Host ("enabledApiProposals (from EnabledApiProposalsJson): " + ($enabledApiProposals -join ', ')) - $allowProposedApisArgs = @('--allow-proposed-apis') + @($enabledApiProposals) + $allowProposedApisArgs = @('--allow-proposed-apis') + $enabledApiProposals } else { Write-Host "EnabledApiProposalsJson parsed as empty; no proposed API allowlist flags needed." } From 6e449dc290450667314d00e5cd963bd15847656a Mon Sep 17 00:00:00 2001 From: bschnurr Date: Fri, 23 Jan 2026 09:12:27 -0800 Subject: [PATCH 4/4] uncomment publish --- build/templates/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/templates/publish.yml b/build/templates/publish.yml index f800bfe6..0865c45d 100644 --- a/build/templates/publish.yml +++ b/build/templates/publish.yml @@ -143,13 +143,13 @@ steps: if ($allowProposedApisDisplay) { $displayCmd += " $allowProposedApisDisplay" } $displayCmd += ' --pre-release' Write-Host $displayCmd - # npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath $allowProposedApisArgs --pre-release + npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath $allowProposedApisArgs --pre-release } else { Write-Host 'Publishing as stable release' $displayCmd = "Executing: npx @vscode/vsce@latest publish --pat *** --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath" if ($allowProposedApisDisplay) { $displayCmd += " $allowProposedApisDisplay" } Write-Host $displayCmd - # npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath $allowProposedApisArgs + npx @vscode/vsce@latest publish --pat $aadToken --packagePath $vsixPath --manifestPath $manifestPath --signaturePath $signaturePath $allowProposedApisArgs } if ($LASTEXITCODE -ne 0) {