diff --git a/.gitignore b/.gitignore index 79601465a0..ed3f80a4ec 100644 --- a/.gitignore +++ b/.gitignore @@ -361,6 +361,4 @@ src/common/Telemetry/*.etl /src/settings-ui/Settings.UI/Assets/Settings/search.index.json # PowerToysInstaller Build Temp Files -installer/*/*.wxs.bk -# Generated sparse manifest embedded into ImageResizer UI executable -src/modules/imageresizer/ui/ImageResizerUI.exe.manifest \ No newline at end of file +installer/*/*.wxs.bk \ No newline at end of file diff --git a/src/PackageIdentity/PackageIdentity.vcxproj b/src/PackageIdentity/PackageIdentity.vcxproj index bdfa627a11..b8bd2dc1f2 100644 --- a/src/PackageIdentity/PackageIdentity.vcxproj +++ b/src/PackageIdentity/PackageIdentity.vcxproj @@ -9,10 +9,10 @@ - + - -NoSign - + -NoSign + -CIBuild @@ -47,6 +47,7 @@ {E2A5A82E-1E5B-4C8D-9A4F-2B1A8F9E5C3D} PackageIdentity PackageIdentity + false diff --git a/src/PackageIdentity/readme.md b/src/PackageIdentity/readme.md index cd28e44cc4..935e8863b3 100644 --- a/src/PackageIdentity/readme.md +++ b/src/PackageIdentity/readme.md @@ -67,14 +67,14 @@ Get-AppxPackage -Name Microsoft.PowerToys.SparseApp | Remove-AppxPackage ## CI-specific guidance - Pass `-CIBuild` to `BuildSparsePackage.ps1` (or build with `msbuild PackageIdentity.vcxproj /p:CIBuild=true`). This prevents the script from rewriting the manifest publisher to the local dev certificate subject. -- The project automatically adds `-NoSign` when you build Debug or when `$(CIBuild)` is `true`. Provide your own signing step in CI if the package must be signed. +- The project automatically adds `-NoSign` only when `$(CIBuild)` is `true`. Local Debug and Release builds are signed with the development certificate. - Make sure the agent trusts whichever certificate signs the package. If the package remains unsigned (`-NoSign`) it cannot be installed on test machines until it is signed. ## Consuming the identity from other components 1. Add a new `` entry inside `src/PackageIdentity/AppxManifest.xml`. Use a unique `Id` (for example `PowerToys.MyModuleUI`) and set `Executable` to the Win32 binary relative to the `-ExternalLocation` root. 2. Ensure the binary is copied into the platform/configuration output folder (`x64\Release`, `ARM64\Debug`, etc.) so the sparse package can locate it. -3. Embed a sparse identity manifest in the Win32 binary so it binds to the MSIX identity at runtime. The manifest must declare an `` element with `packageName="Microsoft.PowerToys.SparseApp"`, `applicationId` matching the ``, and a `publisher` that matches the sparse package. Local builds can read the publisher from `src/PackageIdentity/.user/PowerToysSparse.publisher.txt` (emitted by `BuildSparsePackage.ps1`). See `src/modules/imageresizer/ui/ImageResizerUI.csproj` for an example MSBuild target (`GenerateSparseIdentityManifest`) that writes `ImageResizerUI.exe.manifest` and sets `ApplicationManifest` automatically. +3. Embed a sparse identity manifest in the Win32 binary so it binds to the MSIX identity at runtime. The manifest must declare an `` element with `packageName="Microsoft.PowerToys.SparseApp"`, `applicationId` matching the ``, and a `publisher` that matches the sparse package. Keep the manifest’s publisher in sync with `src/PackageIdentity/.user/PowerToysSparse.publisher.txt` (emitted by `BuildSparsePackage.ps1`). See `src/modules/imageresizer/ui/ImageResizerUI.csproj` for an example that points `ApplicationManifest` to `ImageResizerUI.dev.manifest` for local builds and switches to `ImageResizerUI.prod.manifest` when `$(CIBuild)` is `true`. 4. Register or re-register the sparse package so Windows learns about the new application Id. 5. To launch the Win32 surface with identity, use the `shell:AppsFolder` activation form (for example: `shell:AppsFolder\Microsoft.PowerToys.SparseApp_!PowerToys.MyModuleUI`) or activate it via `IApplicationActivationManager::ActivateApplication` using the same AppUserModelID. diff --git a/src/modules/imageresizer/ui/ImageResizerUI.csproj b/src/modules/imageresizer/ui/ImageResizerUI.csproj index d71a4c6888..b146db8435 100644 --- a/src/modules/imageresizer/ui/ImageResizerUI.csproj +++ b/src/modules/imageresizer/ui/ImageResizerUI.csproj @@ -25,10 +25,11 @@ - CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US - Microsoft.PowerToys.SparseApp - PowerToys.ImageResizerUI - $(IntermediateOutputPath)ImageResizerUI.exe.manifest + ImageResizerUI.dev.manifest + + + + ImageResizerUI.prod.manifest @@ -72,27 +73,4 @@ - - - $(SparsePackagePublisherDefault) - - - - - - $(SparsePackagePublisherFromFile) - - - - - - - - - - - - $(GeneratedSparseManifest) - - \ No newline at end of file diff --git a/src/modules/imageresizer/ui/ImageResizerUI.dev.manifest b/src/modules/imageresizer/ui/ImageResizerUI.dev.manifest new file mode 100644 index 0000000000..cb91bc2b66 --- /dev/null +++ b/src/modules/imageresizer/ui/ImageResizerUI.dev.manifest @@ -0,0 +1,8 @@ + + + + + diff --git a/src/modules/imageresizer/ui/ImageResizerUI.prod.manifest b/src/modules/imageresizer/ui/ImageResizerUI.prod.manifest new file mode 100644 index 0000000000..bbb50a9ec5 --- /dev/null +++ b/src/modules/imageresizer/ui/ImageResizerUI.prod.manifest @@ -0,0 +1,8 @@ + + + + +