Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion HomeAssistantCommandPalette/HomeAssistantCommandPalette.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<ProjectCapability Include="Msix" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CommandPalette.Extensions" />
<PackageReference Include="Microsoft.CommandPalette.Extensions" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
<PackageReference Include="Microsoft.Windows.CsWinRT" />
<PackageReference Include="Shmuelie.WinRTServer" />
Expand Down Expand Up @@ -115,4 +115,21 @@
<PublishTrimmed>true</PublishTrimmed>
<ILLinkTreatWarningsAsErrors>false</ILLinkTreatWarningsAsErrors>
</PropertyGroup>

<!--
The CmdPal host builds the cross-process proxy for IExtension from the
interface metadata, so Microsoft.CommandPalette.Extensions.winmd MUST ship
in the package. The SDK package marks it CopyToOutputDirectory but not
CopyToPublishDirectory, so `dotnet publish` (and therefore the packed MSIX)
drops it — without it, activation fails with E_NOINTERFACE (0x80004002) and
the extension shows no commands. Force it into the publish output.
-->
<Target Name="IncludeCmdPalSdkWinmdInPublish" BeforeTargets="ComputeFilesToPublish">
<ItemGroup>
<ResolvedFileToPublish Include="$(PkgMicrosoft_CommandPalette_Extensions)\winmd\Microsoft.CommandPalette.Extensions.winmd">
<RelativePath>Microsoft.CommandPalette.Extensions.winmd</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</ResolvedFileToPublish>
</ItemGroup>
</Target>
</Project>
28 changes: 4 additions & 24 deletions HomeAssistantCommandPalette/build-msix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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")) {
Expand All @@ -166,15 +146,15 @@ 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

& $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)
Expand Down
Binary file not shown.
Binary file not shown.
45 changes: 0 additions & 45 deletions tools/cmdpal-sdk/README.md

This file was deleted.

Loading