Skip to content

Conversation

@lei9444
Copy link
Contributor

@lei9444 lei9444 commented Jul 1, 2025

Summary of the Pull Request

This Bug started when the Win11 context menu integration was first introduced by Image Resizer in version v0.60.0.

Move Image Resizer to the WinUI3Apps folder to fix file preview issue when PowerToys is installed on a non-C:\Program Files.
This aligns with the current structure used by File Locksmith and PowerRename, which are not WinUI 3 apps either, but are already located there.

Root Cause:

When registering an MSIX package, the Windows API adds certain user permissions to the installation folders. Since Image Resizer was previously placed under the main PowerToys directory, these permission changes could prevent Explorer from loading its preview handler properly in per-user scenarios.

image

Interestingly, this issue only affects per-user installs, not machine-wide installs (e.g., to Program Files), even though both locations receive additional permissions. The exact reason is still unclear and requires further investigation.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@lei9444 lei9444 changed the title Fix: File preview didn't work with per-user installation Fix: File explorer preview didn't work with per-user installation Jul 1, 2025
@yeelam-gordon yeelam-gordon added Product-File Explorer Power Toys that touch explorer like Preview Pane Hot Fix Items we will product an out-of-band release for labels Jul 7, 2025
@yeelam-gordon yeelam-gordon added this to the PowerToys 0.92 milestone Jul 7, 2025
@yeelam-gordon yeelam-gordon merged commit 7772bfb into main Jul 7, 2025
20 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR relocates the Image Resizer extension and its assets into the WinUI3Apps directory to restore Explorer preview support in per-user installations and match other WinUI3-based modules.

  • Updates runner code to load the Resizer preview handler from the new WinUI3Apps path
  • Changes all Image Resizer project outputs to emit into the WinUI3Apps folder
  • Adjusts installer PowerShell script and WiX files to reference the WinUI3Apps paths

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/runner/main.cpp Point PowerToys.ImageResizerExt.dll lookup to WinUI3Apps/…
src/modules/imageresizer/ui/ImageResizerUI.csproj Set <OutputPath> to include WinUI3Apps subfolder
src/modules/imageresizer/dll/ImageResizerExt.vcxproj Change <OutDir> to output under WinUI3Apps
src/modules/imageresizer/ImageResizerLib/ImageResizerLib.vcxproj Change <OutDir> to output under WinUI3Apps
src/modules/imageresizer/ImageResizerContextMenu/ImageResizerContextMenu.vcxproj Change <OutDir> to output under WinUI3Apps
installer/PowerToysSetup/generateAllFileComponents.ps1 Update depsPath to point at WinUI3Apps\Assets\ImageResizer
installer/PowerToysSetup/Resources.wxs Reference resource DLLs under WinUI3Apps\$(var.Language)
installer/PowerToysSetup/ImageResizer.wxs Swap to WinUI3AppsAssetsFolder and registry path
Comments suppressed due to low confidence (3)

src/runner/main.cpp:152

  • Consider adding an automated test to verify that the ImageResizerExt preview handler is correctly registered and loaded from the WinUI3Apps directory in per-user installation scenarios.
            L"WinUI3Apps/PowerToys.ImageResizerExt.dll",

installer/PowerToysSetup/ImageResizer.wxs:11

  • Verify that the DirectoryRef Id 'WinUI3AppsAssetsFolder' is declared in your Common.wxi or installer definitions; if it isn't, the installer build will fail due to an undefined directory reference.
    <DirectoryRef Id="WinUI3AppsAssetsFolder">

installer/PowerToysSetup/generateAllFileComponents.ps1:182

  • Confirm that your Image Resizer assets are actually output to 'Release\WinUI3Apps\Assets\ImageResizer'; if not, update the build or script to match the real output location or move the assets accordingly.
Generate-FileList -fileDepsJson "" -fileListName ImageResizerAssetsFiles -wxsFilePath $PSScriptRoot\ImageResizer.wxs -depsPath "$PSScriptRoot..\..\..\$platform\Release\WinUI3Apps\Assets\ImageResizer"

L"PowerToys.FancyZonesModuleInterface.dll",
L"PowerToys.powerpreview.dll",
L"PowerToys.ImageResizerExt.dll",
L"WinUI3Apps/PowerToys.ImageResizerExt.dll",
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The literal "WinUI3Apps" is repeated across multiple projects and installer scripts; consider centralizing this folder name as a shared MSBuild property or PowerShell variable to reduce duplication and prevent typos.

Copilot uses AI. Check for mistakes.
yeelam-gordon pushed a commit that referenced this pull request Jul 7, 2025
…0314)

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
This Bug started when the Win11 context menu integration was first
introduced by Image Resizer in version v0.60.0.

Move Image Resizer to the WinUI3Apps folder to fix file preview issue
when PowerToys is installed on a non-C:\Program Files.
This aligns with the current structure used by File Locksmith and
PowerRename, which are not WinUI 3 apps either, but are already located
there.

### Root Cause:
When registering an MSIX package, the Windows API adds certain user
permissions to the installation folders. Since Image Resizer was
previously placed under the main PowerToys directory, these permission
changes could prevent Explorer from loading its preview handler properly
in per-user scenarios.


![image](https://github.com/user-attachments/assets/a8626314-19ce-4e25-87d6-d5e74a015e68)

Interestingly, this issue only affects per-user installs, not
machine-wide installs (e.g., to Program Files), even though both
locations receive additional permissions. The exact reason is still
unclear and requires further investigation.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] **Closes:** #24384 #29644 #32113 #34139 #37866 #40345
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hot Fix Items we will product an out-of-band release for Product-File Explorer Power Toys that touch explorer like Preview Pane

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants