Skip to content
Open
Show file tree
Hide file tree
Changes from 108 commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
a48e741
initial
khmyznikov Mar 10, 2026
eed0e20
fix shortcut
khmyznikov Mar 10, 2026
ecc93ea
more customization
khmyznikov Mar 11, 2026
1c78950
more improvements
khmyznikov Mar 12, 2026
6072ec7
fix settings buttons
khmyznikov Mar 12, 2026
74eafb5
Custom models picker, default models picker
khmyznikov Mar 12, 2026
f6149bb
default provider
khmyznikov Mar 12, 2026
a025d4d
add settings collapse
khmyznikov Mar 13, 2026
f8b1586
Phi Silica not tested
khmyznikov Mar 17, 2026
a3620f1
add settings ui manifest
khmyznikov Mar 19, 2026
a25ce4e
WinAppSdk 2.0 try
khmyznikov Mar 19, 2026
b5fc9fe
Revert "WinAppSdk 2.0 try"
khmyznikov Mar 19, 2026
51c5d32
upgrade to 260317003
khmyznikov Mar 19, 2026
dc14845
Add LAF helper
khmyznikov Mar 19, 2026
8224062
add workaround
khmyznikov Mar 20, 2026
c2789d6
launch hacks
khmyznikov Mar 21, 2026
a60eab4
add more params from sample
khmyznikov Mar 21, 2026
32ffd3a
change workaround
khmyznikov Mar 22, 2026
9421efe
update readme
khmyznikov Mar 22, 2026
fd96b46
Add laf as ADO secret
khmyznikov Mar 22, 2026
0a2bc81
fix laf attestation string
khmyznikov Mar 23, 2026
f53e64a
fix xaml
khmyznikov Mar 23, 2026
9f6d6b9
Fix build
khmyznikov Mar 23, 2026
0343840
fix installer
khmyznikov Mar 24, 2026
0bc4504
Merge branch 'gleb/advanced-paste' of https://github.com/microsoft/Po…
khmyznikov Mar 24, 2026
401ddcd
move AP to packaged identity
khmyznikov Mar 24, 2026
d28ae33
fix ap package
khmyznikov Mar 25, 2026
4fac403
debug build
khmyznikov Mar 25, 2026
36366e1
fix msix
khmyznikov Mar 25, 2026
c46e614
fix build
khmyznikov Mar 26, 2026
26bbfde
another try
khmyznikov Mar 26, 2026
3dfeece
Merge branch 'main' into gleb/advanced-paste
khmyznikov Mar 26, 2026
7436b46
another try 2
khmyznikov Mar 26, 2026
9befd28
another try 3
khmyznikov Mar 26, 2026
ab9a8c9
fix ap msix search
khmyznikov Mar 26, 2026
ce8508e
fix ap vnext
khmyznikov Mar 26, 2026
c43261f
keep fixing msix
khmyznikov Mar 27, 2026
faae1ae
to prev
khmyznikov Mar 27, 2026
00bc7ec
to prev 2
khmyznikov Mar 27, 2026
749378d
to prev 3
khmyznikov Mar 28, 2026
3281c0e
fix missing VCLibs
khmyznikov Mar 28, 2026
d628d73
AP DisableTransitiveFrameworkReferences
khmyznikov Mar 30, 2026
011fc5a
exclude AP from audit
khmyznikov Mar 30, 2026
dbae67d
Fixing AP crash
khmyznikov Mar 30, 2026
d776b64
another thing
khmyznikov Mar 30, 2026
68eb695
maybe final fix?
khmyznikov Mar 31, 2026
822303a
fix LAF tokens
khmyznikov Mar 31, 2026
9e02f48
fix debug tokens
khmyznikov Mar 31, 2026
96c5d16
Fix AP uninstall
khmyznikov Apr 1, 2026
3269de6
Merge branch 'main' into gleb/advanced-paste
khmyznikov May 8, 2026
7416209
address PR review
khmyznikov May 9, 2026
ca7bc16
to prev
khmyznikov May 10, 2026
8370908
build fix on VS2026
khmyznikov May 10, 2026
79f850b
Merge remote-tracking branch 'origin/main' into gleb/advanced-paste
khmyznikov May 11, 2026
6657da8
move to wasdk 2.0
khmyznikov May 11, 2026
c2caa46
to prev
khmyznikov May 11, 2026
832edcd
fix vnext
khmyznikov May 12, 2026
d3c8b48
fix spelling
khmyznikov May 12, 2026
17a0533
fix ap tests
khmyznikov May 12, 2026
3619593
get back to sparse
khmyznikov May 18, 2026
0fcd729
revert the CI changes
khmyznikov May 19, 2026
125fffc
fix vnext
khmyznikov May 19, 2026
279aaf6
fix the pipeline
khmyznikov May 19, 2026
6d1c414
fix vnext
khmyznikov May 19, 2026
7da7a0b
AdvancedPaste: flatten install layout to WinUI3Apps root
khmyznikov May 19, 2026
abcb77d
AdvancedPaste: rename ProjectPriFileName to PowerToys.AdvancedPaste.pri
khmyznikov May 19, 2026
5931b3d
ESRPSigning_core: drop AdvancedPaste subfolder path
khmyznikov May 20, 2026
b2251ca
wixproj: pass CmdPalPackagePath/CmdPalPackageDir defines to WiX
khmyznikov May 20, 2026
f4ddb79
Revert flatten: restore AP subfolder layout with heat harvest + ICE03…
khmyznikov May 20, 2026
7a3539f
Revert heat-based installer: AP is flat in WinUI3Apps like ImageResizer
khmyznikov May 20, 2026
ec475f0
to prev
khmyznikov May 20, 2026
0f7c3f7
AdvancedPaste: pass PRI filename to ResourceLoader explicitly
khmyznikov May 20, 2026
c6176fb
AdvancedPaste: revert PRI to resources.pri for XAML LoadComponent
khmyznikov May 20, 2026
020dd67
Revert PRI to PowerToys.AdvancedPaste.pri: resources.pri breaks Settings
khmyznikov May 20, 2026
9ea621b
Bump WindowsAppSDK.Foundation to 2.0.22 (sparse PRI fix)
khmyznikov May 29, 2026
450568a
Revert generated installer wxs files and stale build artifacts
khmyznikov May 29, 2026
6f98152
revert change
khmyznikov May 29, 2026
cc55315
Merge branch 'main' into gleb/advanced-paste
khmyznikov May 29, 2026
e7e3db8
Merge branch 'main' into gleb/advanced-paste
khmyznikov May 29, 2026
e9221d2
Merge branch 'gleb/advanced-paste' of https://github.com/microsoft/Po…
khmyznikov May 29, 2026
ccbd288
Merge branch 'gleb/advanced-paste' of https://github.com/microsoft/Po…
khmyznikov May 29, 2026
5e0f92f
Merge branch 'gleb/advanced-paste' of https://github.com/microsoft/Po…
khmyznikov May 29, 2026
56af1e4
Merge branch 'gleb/advanced-paste' of https://github.com/microsoft/Po…
khmyznikov May 29, 2026
046796a
Merge branch 'gleb/advanced-paste' of https://github.com/microsoft/Po…
khmyznikov May 29, 2026
96fb1d0
docs: fix stale PRI and path references in advancedpaste.md
khmyznikov May 29, 2026
2572b12
bump to 2.2.2-experimental9
khmyznikov Jun 10, 2026
aa09683
revert nuget config
khmyznikov Jun 10, 2026
faf0a7c
return Foundation version
khmyznikov Jun 10, 2026
a2ee84f
fix xaml warnings
khmyznikov Jun 10, 2026
c648980
temp fix for resources
khmyznikov Jun 10, 2026
a782972
Revert temp continueOnError on Touchdown step; service recovered
khmyznikov Jun 10, 2026
b63c319
Merge remote-tracking branch 'origin/main' into gleb/advanced-paste
khmyznikov Jun 10, 2026
ca38547
ci: run cmdpal versioning setup last so CmdPalVersion matches stamped…
khmyznikov Jun 11, 2026
4d1171f
fix AP location call
khmyznikov Jun 11, 2026
64071b7
add model prepare
khmyznikov Jun 11, 2026
2019d0b
fix AI package version
khmyznikov Jun 11, 2026
1729e26
add model download trigger + winappsdk version fix
khmyznikov Jun 11, 2026
3768a95
Merge branch 'main' into gleb/advanced-paste
khmyznikov Jun 11, 2026
714da1a
add unlock status
khmyznikov Jun 12, 2026
54943c9
fix missing metadata
khmyznikov Jun 12, 2026
f6c8550
some knowlegde updates
khmyznikov Jun 12, 2026
2710f0c
fix winmd collision
khmyznikov Jun 12, 2026
4ce6529
Address PR review
khmyznikov Jun 13, 2026
b123a4f
fix wording
khmyznikov Jun 13, 2026
05e4076
remove unused word
khmyznikov Jun 13, 2026
6e6e637
Merge branch 'main' into gleb/advanced-paste
khmyznikov Jun 16, 2026
780abe1
add more details for API state
khmyznikov Jun 16, 2026
c52d147
Restore SCL to spell-check expect.txt
niels9001 Jul 8, 2026
d5173b0
Fix Advanced Paste provider and UI review issues
yeelam-gordon Jul 11, 2026
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
5 changes: 5 additions & 0 deletions .github/actions/spell-check/allow/code.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ pwa
AOT
Aot
ify
LAF
Laf
languagemodel
philm
phisilica
TFM

# YML
Expand Down
3 changes: 3 additions & 0 deletions .github/actions/spell-check/patterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ ms-windows-store://\S+
# ANSI color codes
(?:\\(?:u00|x)1[Bb]|\\03[1-7]|\x1b|\\u\{1[Bb]\})\[\d+(?:;\d+)*m

# Phi Silica internal token/ID literals
<PhiSilicaLafToken\b[^>]*>[^<]+</PhiSilicaLafToken>
\bdjwsxzxb4ksa8\b
# Special licenses text from RNNoise (BSD-style disclaimer: ``AS IS'')
``AS IS''

Expand Down
2 changes: 1 addition & 1 deletion .pipelines/v2/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extends:
useManagedIdentity: $(SigningUseManagedIdentity)
clientId: $(SigningOriginalClientId)
# Have msbuild use the release nuget config profile
additionalBuildOptions: /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:EnableCmdPalAOT=true
additionalBuildOptions: /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:EnableCmdPalAOT=true /p:PhiSilicaLafToken=$(PhiSilicaLafToken) /p:PhiSilicaLafAttestation="$(PhiSilicaLafAttestation)"
beforeBuildSteps:
# Install the Terrapin retrieval tool, which replaces vcpkg's download handler
# to redirect it to a safe Microsoft-controlled location
Expand Down
11 changes: 11 additions & 0 deletions .pipelines/v2/templates/job-build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@ jobs:
VCWhereExtraVersionTarget: '-prerelease'

- ${{ if eq(parameters.official, true) }}:
# M.W.T.V Setup.ps1 sets the pipeline-level XES_APPXMANIFESTVERSION env var
# from the supplied -ProjectDirectory's custom.props. Whichever invocation
# runs last wins. cmdpal MUST run last because $(CmdPalVersion) (used by the
# VNext installer and CmdPal's AppxPackageTestDir) falls back to that env
# var; if AP wins, CmdPal's folder name and MSIX filename disagree on
# VersionMinor and the installer fails with WIX0103. Each project's own
# custom.props is still applied at MSBuild time, so AP versioning is
# unaffected by the order.
- template: .\steps-setup-versioning.yml
parameters:
directory: $(build.sourcesdirectory)\src\modules\AdvancedPaste
- template: .\steps-setup-versioning.yml
parameters:
directory: $(build.sourcesdirectory)\src\modules\cmdpal
Expand Down
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
</PropertyGroup>
<Import Project="$(RepoRoot)src\Version.props" />
<Import Project="$(RepoRoot)src\PhiSilicaLaf.props" />
<PropertyGroup>
<Copyright>Copyright (C) Microsoft Corporation. All rights reserved.</Copyright>
<AssemblyCopyright>Copyright (C) Microsoft Corporation. All rights reserved.</AssemblyCopyright>
Expand Down
100 changes: 100 additions & 0 deletions doc/devdocs/modules/advancedpaste-phisilica-local-testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Advanced Paste – Phi Silica local testing

How to build, register, and test **Phi Silica** in **Advanced Paste (AP)** on a dev machine,
plus the few things that actually break it.

## How it fits together

AP ships as an **unpackaged, self-contained WinUI 3 exe** (`PowerToys.AdvancedPaste.exe`).
The Windows AI `LanguageModel` (Phi Silica) API is a **Limited Access Feature (LAF)**. For it
to work, all of these must line up:

1. **Package identity** — AP runs with identity granted by the sparse MSIX
`Microsoft.PowerToys.SparseApp`.
2. **Matching LAF creds** — the token/attestation baked into the exe match the registered
sparse package's publisher.
3. **AI metadata deployed** — the `Microsoft.Windows.AI*.winmd` files ship next to the exe;
the AI runtime resolves them **at runtime**.
4. **Model ready** — supported hardware and the on-device model downloaded
(`GetReadyState() == Ready`).

Two identities — the baked token must match the registered package's publisher:

| Build | Publisher Id | LAF creds |
|-------|--------------|-----------|
| **Dev** | `djwsxzxb4ksa8` | dev default in [`src/PhiSilicaLaf.props`](../../../src/PhiSilicaLaf.props) |
| **Prod** | `8wekyb3d8bbwe` | secret, injected only by `.pipelines/v2/release.yml` |

Non-secret pairing check: the exe's baked **Attestation** must equal the registered package's
**PublisherId**.

## Build + register (dev loop)

```powershell
$repo = "X:\GitHub\PowerToys"; $Plat = "ARM64"; $Cfg = "Debug" # or x64 / Release

# Build AP only (C#; reuses existing C++ outputs):
dotnet restore "$repo\src\modules\AdvancedPaste\AdvancedPaste\AdvancedPaste.csproj" /p:Platform=$Plat
& "$repo\tools\build\build.cmd" -Path "$repo\src\modules\AdvancedPaste\AdvancedPaste" `
-Platform $Plat -Configuration $Cfg /p:BuildProjectReferences=false

# Register the dev sparse package (creates + trusts a dev cert, grants identity):
pwsh -ExecutionPolicy Bypass -File "$repo\src\PackageIdentity\BuildSparsePackage.ps1" `
-Platform $Plat -Configuration $Cfg -DevRegister
# Expect: PublisherId djwsxzxb4ksa8, IsDevelopmentMode True
```

## Check the API

`PowerToys.AdvancedPaste.exe` is a **GUI-subsystem** app — run directly in a console it prints
nothing and returns no exit code. **Redirect** stdout/stderr and wait:

```powershell
$exe = "$repo\$Plat\$Cfg\WinUI3Apps\PowerToys.AdvancedPaste.exe"
$o = "$env:TEMP\ap.out"; $e = "$env:TEMP\ap.err"
$p = Start-Process $exe '--check-phi-silica' -Wait -PassThru -WindowStyle Hidden `
-RedirectStandardOutput $o -RedirectStandardError $e
"exit=$($p.ExitCode) stdout=$((Get-Content $o -Raw).Trim())"
Get-Content $e -Raw # stderr: [phi-silica] LAF unlock status: <…>; ReadyState: <…>
```

| `--check-phi-silica` | `--prepare-phi-silica` (downloads the model) |
|----------------------|----------------------------------------------|
| `0` Available · `1` NotReady · `2` NotSupported / unlock failed | `0` Ready · `1` Failed · `2` NotSupported |

`--check` only reads state; use `--prepare` to trigger the model download (`EnsureReadyAsync`).
On failure it prints the `HRESULT` to stderr.

Confirm the running AP has identity:

```powershell
$apPid = (Get-Process PowerToys.AdvancedPaste -EA SilentlyContinue | Select-Object -First 1).Id
if ($apPid) { & "$repo\src\PackageIdentity\Check-ProcessIdentity.ps1" -ProcessId $apPid }
# Expect a PFN ending in the publisher id that matches the baked attestation
```

## What actually breaks it

- **Missing `.winmd` (most important).** The Windows AI runtime resolves
`Microsoft.Windows.AI*.winmd` from the app folder at runtime. If they aren't deployed,
`GetReadyState()` returns `NotReady` and `EnsureReadyAsync()` fails with
`RO_E_METADATA_NAME_NOT_FOUND` (`0x8000000F`) — even though identity, token, and the AI DLLs
are all correct. The build emits these winmd into `WinUI3Apps\`; the **installer must harvest
them** (`*.winmd` is in the inclusion list of
[`generateAllFileComponents.ps1`](../../../installer/PowerToysSetupVNext/generateAllFileComponents.ps1)).
Classic symptom: "works from the build output but not from the installer" → check that the
installed `WinUI3Apps\` contains `Microsoft.Windows.AI*.winmd`.
- **Dev/prod mismatch.** A dev-cred exe running against a prod sparse package (or vice versa)
makes the LAF unlock silently return `Unavailable`. Keep the exe and the registered package
the same flavor, and verify with the attestation == publisherId check above.
- **Forgot to redirect.** `--check-phi-silica` in a console prints nothing — that's the
GUI-subsystem quirk, not a result.

## Cleanup

```powershell
pwsh -ExecutionPolicy Bypass -File "$repo\src\PackageIdentity\BuildSparsePackage.ps1" -Unregister
```

⚠️ This removes any `Microsoft.PowerToys.SparseApp` registration, **including a prod one** from
an installer — reinstall/repair PowerToys to restore it.
76 changes: 75 additions & 1 deletion doc/devdocs/modules/advancedpaste.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,81 @@ See the `ExecutePasteFormatAsync(PasteFormat, PasteActionSource)` method in `Opt

## Debugging

TODO: Add debugging information
Advanced Paste is an unpackaged, self-contained WinUI 3 app (`PowerToys.AdvancedPaste.exe`). To call Windows AI APIs (Phi Silica / `Microsoft.Windows.AI.Text.LanguageModel`) it acquires **package identity** at runtime via a shared sparse MSIX package (`Microsoft.PowerToys.SparseApp`).

### Running and attaching the debugger

1. Set the **Runner** project (`src/runner`) as the startup project in Visual Studio.
2. Launch the Runner (F5). This starts the PowerToys tray icon and loads all module interfaces.
3. Open Settings (right-click tray icon → Settings) and enable the **Advanced Paste** module if it isn't already. The module launches `PowerToys.AdvancedPaste.exe` in the background immediately.
4. In Visual Studio, go to **Debug → Attach to Process** (`Ctrl+Alt+P`) and attach to `PowerToys.AdvancedPaste.exe` (select **Managed (.NET Core)** debugger).

Alternatively, use the VS Code launch configuration **"Run AdvancedPaste"** from [.vscode/launch.json](/.vscode/launch.json) to launch the exe directly — but note that without the Runner, IPC and hotkeys won't work.

### Sparse package identity (local development)

#### Why is this needed?

- The `LanguageModel` API requires a Limited Access Feature (LAF) unlock, which only succeeds when the calling process has a matching package identity.
- Advanced Paste is an unpackaged, self-contained WinUI 3 app. The sparse package grants it identity without converting it to a full MSIX.
- The csproj uses `<ProjectPriFileName>PowerToys.AdvancedPaste.pri</ProjectPriFileName>` (matching the convention of other WinUI3 apps like ImageResizer). This requires WindowsAppSDK Foundation >= 2.0.22 ([PR #6376](https://github.com/microsoft/WindowsAppSDK/pull/6376)) which fixes MRT PRI lookup under sparse identity so `Application.LoadComponent` resolves custom-named PRI files instead of hard-coding `resources.pri`.

#### One-step dev setup

```powershell
pwsh src/PackageIdentity/BuildSparsePackage.ps1 -Platform ARM64 -Configuration Debug -DevRegister
```

`-DevRegister`:
1. Generates a dev certificate under `src/PackageIdentity/.user/` (first run only).
2. Auto-imports that certificate into `CurrentUser\TrustedPeople` and `CurrentUser\Root` so the OS grants sparse identity to AP (without trust, `GetPackageFamilyName` returns `APPMODEL_ERROR_NO_PACKAGE` and LAF unlock silently fails).
3. Removes any prior registration.
4. Rewrites the publisher in a temp copy of `AppxManifest.xml` to match the dev cert subject.
5. Registers via `Add-AppxPackage -Register … -ExternalLocation X:\…\<Platform>\<Config>\WinUI3Apps`.

After registration verify:

```powershell
$pkg = Get-AppxPackage -Name '*SparseApp*'
$pkg.PackageFamilyName # Microsoft.PowerToys.SparseApp_<PublisherId>
$pkg.PublisherId # djwsxzxb4ksa8
$pkg.IsDevelopmentMode # True
```

Confirm AP picks up sparse identity at runtime:

```powershell
& 'ARM64\Debug\WinUI3Apps\PowerToys.AdvancedPaste.exe' --check-phi-silica
# Exit 0 = Available, 1 = NotReady, 2 = NotSupported
```

Re-register after rebuilding AP, changing `src/PackageIdentity/AppxManifest.xml`, or switching platforms/configurations by re-running the same command. Unregister with `-Unregister`.

#### Troubleshooting

| Problem | Cause | Fix |
|---------|-------|-----|
| `GetPackageFamilyName` returns `APPMODEL_ERROR_NO_PACKAGE` (15700) at runtime; LAF unlock returns `Unavailable` | Dev certificate not trusted (or sparse package not registered) | Re-run `BuildSparsePackage.ps1 -DevRegister` — auto-imports the cert into `TrustedPeople` and `Root`. |
| `Microsoft.UI.Xaml.dll` crash with `0xC000027B` (class-not-registered) on AP or Settings startup | `<Application>` `Executable` path in `src/PackageIdentity/AppxManifest.xml` does not resolve under the registered `ExternalLocation` (`<Config>\WinUI3Apps\`) | Confirm every `Executable` is relative to `WinUI3Apps\` (per #47177) and the file exists under the build output. |
| AP launches but never shows a window when triggered via hotkey | Runner's pipe-server wait timed out before AP's cold-start finished bootstrapping WinAppSDK + DI host | Already mitigated by the 15 s pipe timeout in `AdvancedPasteProcessManager.cpp`; warm-start launches connect in well under 1 s. |
| `XamlParseException` / `ms-appx:///Microsoft.UI.Xaml/Themes/…` not found | WindowsAppSDK Foundation < 2.0.22; MRT can't resolve custom PRI name under sparse identity | Ensure `Microsoft.WindowsAppSDK.Foundation` >= 2.0.22 in `Directory.Packages.props`. |

### How Settings UI checks Phi Silica availability

Settings UI does not have sparse package identity. To check whether Phi Silica is available, it launches Advanced Paste as a short-lived subprocess:

```
PowerToys.AdvancedPaste.exe --check-phi-silica
```

`Program.Main` recognizes this flag, calls `PhiSilicaLafHelper.TryUnlock()` + `LanguageModel.GetReadyState()`, prints one of `Available` / `NotReady` / `NotSupported` to stdout, and exits with the matching code (0/1/2). Settings reads stdout with a 10 s wait. Because each call is a fresh process, transient `Unavailable` results are not cached across checks.

### See also

- [Phi Silica local testing & troubleshooting guide](advancedpaste-phisilica-local-testing.md) — layer-by-layer diagnostics for Phi Silica availability
- [`src/PackageIdentity/readme.md`](/src/PackageIdentity/readme.md) — full sparse package documentation
- [microsoft/microsoft-ui-xaml#10856](https://github.com/microsoft/microsoft-ui-xaml/issues/10856) — original WinUI sparse-identity PRI bug
- [microsoft/WindowsAppSDK#6376](https://github.com/microsoft/WindowsAppSDK/pull/6376) — MRT sparse PRI fix (Foundation >= 2.0.22)

## Settings

Expand Down
13 changes: 12 additions & 1 deletion installer/PowerToysSetupVNext/generateAllFileComponents.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,23 @@ Function Generate-FileList() {

$fileExclusionList = @("*.pdb", "*.lastcodeanalysissucceeded", "createdump.exe", "powertoys.exe")

$fileInclusionList = @("*.dll", "*.exe", "*.json", "*.msix", "*.png", "*.gif", "*.ico", "*.cur", "*.svg", "index.html", "reg.js", "gitignore.js", "srt.js", "monacoSpecialLanguages.js", "customTokenThemeRules.js", "*.pri", "*.yml")
# *.winmd: WinRT metadata for the Windows App SDK AI APIs (Phi Silica, Imaging, etc.). The AI
# runtime resolves these from the app directory at runtime, so they must ship with the product.
# Without them GetReadyState() reports NotReady and EnsureReadyAsync() fails with
# RO_E_METADATA_NAME_NOT_FOUND (0x8000000F). The build already emits them into the app output
# (e.g. WinUI3Apps); they were previously dropped here because the harvest didn't include them.
$fileInclusionList = @("*.dll", "*.exe", "*.json", "*.msix", "*.png", "*.gif", "*.ico", "*.cur", "*.svg", "index.html", "reg.js", "gitignore.js", "srt.js", "monacoSpecialLanguages.js", "customTokenThemeRules.js", "*.pri", "*.yml", "*.winmd")

# MFC DLLs leak into the output via WindowsAppSDKSelfContained but no PowerToys binary imports them.
# Verified with dumpbin /dependents across all 2176 binaries — zero consumers.
$fileExclusionList += @("mfc140.dll", "mfc140u.dll", "mfcm140.dll", "mfcm140u.dll")

# Microsoft.CommandPalette.Extensions.winmd already has a dedicated WiX component
# (Microsoft_CommandPalette_Extensions_winmd in BaseApplications.wxs, placed in WinUI3Apps for
# CmdPal's WinRT resolution). Exclude it from the generic *.winmd harvest so it isn't declared
# by two components (WIX ICE30 "installed by two different components" breaks ref-counting).
$fileExclusionList += @("Microsoft.CommandPalette.Extensions.winmd")

$dllsToIgnore = @("System.CodeDom.dll", "WindowsBase.dll")

if ($fileDepsJson -eq [string]::Empty) {
Expand Down
10 changes: 10 additions & 0 deletions src/PackageIdentity/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@
AppListEntry="none">
</uap:VisualElements>
</Application>
<Application Id="PowerToys.AdvancedPasteUI" Executable="PowerToys.AdvancedPaste.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements
DisplayName="PowerToys.AdvancedPaste"
Description="PowerToys Advanced Paste"
BackgroundColor="transparent"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png"
AppListEntry="none">
</uap:VisualElements>
</Application>
<Application Id="PowerToys.CmdPalExtension" Executable="Microsoft.CmdPal.Ext.PowerToys.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements
DisplayName="PowerToys.CommandPaletteExtension"
Expand Down
Loading
Loading