diff --git a/HomeAssistantCommandPalette/HomeAssistantCommandPalette.csproj b/HomeAssistantCommandPalette/HomeAssistantCommandPalette.csproj index ccd42a7..ebe1e61 100644 --- a/HomeAssistantCommandPalette/HomeAssistantCommandPalette.csproj +++ b/HomeAssistantCommandPalette/HomeAssistantCommandPalette.csproj @@ -77,7 +77,7 @@ - + @@ -115,4 +115,21 @@ true false + + + + + + Microsoft.CommandPalette.Extensions.winmd + PreserveNewest + + + diff --git a/HomeAssistantCommandPalette/build-msix.ps1 b/HomeAssistantCommandPalette/build-msix.ps1 index 0ff5bc5..0752f37 100644 --- a/HomeAssistantCommandPalette/build-msix.ps1 +++ b/HomeAssistantCommandPalette/build-msix.ps1 @@ -12,11 +12,8 @@ Steps per platform: 1. dotnet publish with WindowsPackageType=MSIX 2. Stage publish output, patch AppxManifest (Version, ProcessorArchitecture, Publisher) - 3. Override Microsoft.CommandPalette.Extensions.dll/winmd with the - vendored copy from tools/cmdpal-sdk (NuGet WinRT IIDs don't match - what CmdPal expects) - 4. makeappx pack -> .msix - 5. (optional) signtool sign with PFX cert + 3. makeappx pack -> .msix + 4. (optional) signtool sign with PFX cert #> param( [Parameter(Mandatory = $true)] @@ -50,9 +47,7 @@ $ErrorActionPreference = "Stop" $ExtensionName = "HomeAssistantCommandPalette" $ProjectDir = $PSScriptRoot -$RepoRoot = Split-Path -Parent $ProjectDir $ProjectFile = Join-Path $ProjectDir "$ExtensionName.csproj" -$VendorSdkDir = Join-Path $RepoRoot "tools\cmdpal-sdk" if (-not $OutputDir) { $OutputDir = Join-Path $ProjectDir "bin\Release\msix" } New-Item -Path $OutputDir -ItemType Directory -Force | Out-Null @@ -74,13 +69,6 @@ foreach ($t in @($makeappx, $signtool)) { } Write-Host "SDK bin: $($sdkBin.FullName)" -ForegroundColor Yellow -# ---------- Validate vendored SDK ---------- -foreach ($f in @("Microsoft.CommandPalette.Extensions.dll", "Microsoft.CommandPalette.Extensions.winmd")) { - if (-not (Test-Path (Join-Path $VendorSdkDir $f))) { - throw "Missing vendored SDK file: $f. See tools/cmdpal-sdk/README.md." - } -} - # ---------- Resolve PFX once if provided ---------- $signingPfx = $null if ($CertBase64) { @@ -149,14 +137,6 @@ try { Remove-Item (Join-Path $stagingDir "Package.appxmanifest") -ErrorAction SilentlyContinue - # ---------- 3. Override SDK DLL/winmd with vendored copy ---------- - # NuGet 0.9.260303001 IIDs don't match CmdPal's internal 0.9.260326002 — - # cast to (ICommandProvider) fails silently without this override. - Copy-Item (Join-Path $VendorSdkDir "Microsoft.CommandPalette.Extensions.dll") ` - (Join-Path $stagingDir "Microsoft.CommandPalette.Extensions.dll") -Force - Copy-Item (Join-Path $VendorSdkDir "Microsoft.CommandPalette.Extensions.winmd") ` - (Join-Path $stagingDir "Microsoft.CommandPalette.Extensions.winmd") -Force - New-Item -ItemType Directory -Path (Join-Path $stagingDir "Public") -Force | Out-Null foreach ($strip in @("build-exe.ps1", "setup-template.iss", "build-msix.ps1", "*.pdb", "app.manifest")) { @@ -166,7 +146,7 @@ try { $appPackagesNested = Join-Path $stagingDir "AppPackages" if (Test-Path $appPackagesNested) { Remove-Item $appPackagesNested -Recurse -Force } - # ---------- 4. makeappx pack ---------- + # ---------- 3. makeappx pack ---------- $msixName = "${ExtensionName}_${Version}.0_${Platform}.msix" $msixPath = Join-Path $OutputDir $msixName Remove-Item $msixPath -Force -ErrorAction SilentlyContinue @@ -174,7 +154,7 @@ try { & $makeappx pack /d $stagingDir /p $msixPath /nv /o if ($LASTEXITCODE -ne 0) { throw "makeappx pack failed for $Platform (exit $LASTEXITCODE)" } - # ---------- 5. Optional signing ---------- + # ---------- 4. Optional signing ---------- if ($signingPfx) { Write-Host "Signing $msixName" -ForegroundColor Yellow $signArgs = @('sign', '/fd', 'SHA256', '/f', $signingPfx) diff --git a/tools/cmdpal-sdk/Microsoft.CommandPalette.Extensions.dll b/tools/cmdpal-sdk/Microsoft.CommandPalette.Extensions.dll deleted file mode 100644 index 69a6210..0000000 Binary files a/tools/cmdpal-sdk/Microsoft.CommandPalette.Extensions.dll and /dev/null differ diff --git a/tools/cmdpal-sdk/Microsoft.CommandPalette.Extensions.winmd b/tools/cmdpal-sdk/Microsoft.CommandPalette.Extensions.winmd deleted file mode 100644 index 8aa9661..0000000 Binary files a/tools/cmdpal-sdk/Microsoft.CommandPalette.Extensions.winmd and /dev/null differ diff --git a/tools/cmdpal-sdk/README.md b/tools/cmdpal-sdk/README.md deleted file mode 100644 index bcaba6d..0000000 --- a/tools/cmdpal-sdk/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# Vendored Command Palette SDK - -This directory holds a copy of `Microsoft.CommandPalette.Extensions.dll` / -`.winmd` extracted from a specific Microsoft Command Palette install. - -## Why it's vendored - -Microsoft ships a newer SDK build inside the Command Palette MSIX than the -latest version published to NuGet (`Microsoft.CommandPalette.Extensions`). -The WinRT IIDs differ between versions, so an extension built against the -NuGet package fails CmdPal's `(ICommandProvider)result` cast at activation — -silently — and never appears in the palette. See PowerToys#47076 / #38273. - -The build script (`HomeAssistantCommandPalette/build-msix.ps1`) overrides the -NuGet-shipped DLL/winmd with the files from this directory before packing -the MSIX, so the runtime IIDs match what CmdPal expects. - -The vendored assembly and WinMD are architecture-neutral metadata/managed -assets, so the same files are used for both x64 and arm64 packages. If a -future Command Palette release ships architecture-specific SDK binaries, -re-extract these files from the matching architecture install and note it -below. - -## Source version - -Extracted from: - -- Package: `Microsoft.CommandPalette_0.9.10852.0_x64__8wekyb3d8bbwe` -- File version: `0.9.2603.26002` - -## Updating - -When CmdPal updates and our extension stops loading after a CmdPal upgrade, -re-extract the DLL from the new install: - -```powershell -$src = (Get-AppxPackage Microsoft.CommandPalette).InstallLocation -Copy-Item "$src\Microsoft.CommandPalette.Extensions.dll" tools\cmdpal-sdk\ -Force -Copy-Item "$src\Microsoft.CommandPalette.Extensions.winmd" tools\cmdpal-sdk\ -Force -``` - -Update the version note above. Commit. Bump the extension version and ship. - -This whole song-and-dance can be removed once Microsoft publishes the matching -SDK version to NuGet.