Files
PowerToys/doc/devdocs/core/installer.md

157 lines
6.4 KiB
Markdown
Raw Normal View History

# PowerToys Installer
Remove WiX v3 infrastructure and migrate exclusively to WiX v5 (#41975) ## Summary: This pull request refactors the installer build pipeline to simplify and modernize the process, focusing exclusively on the WiX 5 (VNext) installer and removing legacy WiX 3 support. It eliminates the use of the `installerSuffix` parameter and related logic, removes the legacy installer build steps and scripts, and updates documentation to reflect the new architecture. The changes streamline the pipeline, reduce complexity, and ensure only the latest installer is built and signed. Pipeline and build system simplification: * Removed the `installerSuffix` parameter and all related logic from pipeline templates and YAML files, including file naming, build steps, and hash calculation scripts. * Removed legacy WiX 3 installer build steps and the associated script `installWiX.ps1`, focusing exclusively on WiX 5 (VNext) installer builds. Installer signing and build process updates: * Updated `.pipelines/ESRPSigning_installer.json` to remove signing configuration for the legacy `PowerToysSetupCustomActions.dll`, ensuring only the VNext DLL is signed. Documentation updates: * Updated `doc/devdocs/core/installer.md` to remove references to WiX 3, clarify the installer architecture as WiX 5 only, and describe the new build process. ## CheckList: - [ ] Should Build successfully and produce installer for both per user and per machine - [ ] Should install without problem --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vanzue <69313318+vanzue@users.noreply.github.com> Co-authored-by: Kai Tao (from Dev Box) <kaitao@microsoft.com>
2025-10-16 16:39:50 -07:00
## Installer Architecture (WiX 5)
- Uses a bootstrapper to check dependencies and close PowerToys
- MSI defined in product.wxs
- Custom actions in C++ for special operations:
- Getting install folder
- User impersonation
- PowerShell module path retrieval
- GPO checking
- Process termination
### Installer Components
- Separate builds for machine-wide and user-scope installation
- Supports x64 and ARM64
- Custom actions DLL must be signed separately before installer build
- WXS files generated during build process for file components
- Localization handling for resource DLLs
- Firewall exceptions for certain modules
### MSI Installer Build Process
Remove WiX v3 infrastructure and migrate exclusively to WiX v5 (#41975) ## Summary: This pull request refactors the installer build pipeline to simplify and modernize the process, focusing exclusively on the WiX 5 (VNext) installer and removing legacy WiX 3 support. It eliminates the use of the `installerSuffix` parameter and related logic, removes the legacy installer build steps and scripts, and updates documentation to reflect the new architecture. The changes streamline the pipeline, reduce complexity, and ensure only the latest installer is built and signed. Pipeline and build system simplification: * Removed the `installerSuffix` parameter and all related logic from pipeline templates and YAML files, including file naming, build steps, and hash calculation scripts. * Removed legacy WiX 3 installer build steps and the associated script `installWiX.ps1`, focusing exclusively on WiX 5 (VNext) installer builds. Installer signing and build process updates: * Updated `.pipelines/ESRPSigning_installer.json` to remove signing configuration for the legacy `PowerToysSetupCustomActions.dll`, ensuring only the VNext DLL is signed. Documentation updates: * Updated `doc/devdocs/core/installer.md` to remove references to WiX 3, clarify the installer architecture as WiX 5 only, and describe the new build process. ## CheckList: - [ ] Should Build successfully and produce installer for both per user and per machine - [ ] Should install without problem --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vanzue <69313318+vanzue@users.noreply.github.com> Co-authored-by: Kai Tao (from Dev Box) <kaitao@microsoft.com>
2025-10-16 16:39:50 -07:00
- First builds `PowerToysSetupCustomActionsVNext` DLL and signs it
- Then builds the installer without cleaning, to reuse the signed DLL
- Uses PowerShell scripts to modify .wxs files before build
- Restores original .wxs files after build completes
- Scripts (`applyBuildInfo.ps1` and `generateFileList.ps1`) dynamically update files list for installer
- Helps manage all self-contained dependencies (.NET, WinAppSDK DLLs, etc.)
- Avoids manual maintenance of file lists
### Special Build Processes
- .NET applications need publishing for correct WebView2 DLL inclusion
- WXS files backed up and regenerated during build
- Monaco UI components (JavaScript/HTML) generated during build
- Localization files downloaded from server during CI release builds
## Per-User vs Per-Machine Installation
- Functionality is identical
- Differences:
- Per-User:
- Installed to `%LOCALAPPDATA%\PowerToys`
- Registry entries in HKCU
- Different users can have different installations/settings
- Per-Machine:
- Installed to `Program Files\PowerToys`
- Registry entries in HKLM
- Single installation shared by all users
- Default is now Per-User installation
- Guards prevent installing both types simultaneously
## MSIX Usage in PowerToys
- Context menu handlers for Windows 11 use sparse MSIX packages
- Previous attempts to create full MSIX installers were abandoned
- Command Palette will use MSIX when merged into PowerToys
- The main PowerToys application still uses MSI for installation
### MSIX Packaging and Extensions
- MSIX packages for extensions (like context menus) are included in the PowerToys installer
- The MSIX files are built as part of the PowerToys build process
- MSIX files are saved directly into the root folder with base application files
- The installer includes MSIX files but doesn't install them automatically
- Packages are registered when a module is enabled
- Code in `package.h` checks if a package is registered and verifies the version
- Packages will be installed if a version mismatch is detected
- When uninstalling PowerToys, the system checks for installed packages with matching display names and attempts to uninstall them
## GPO Files (Group Policy Objects)
- GPO files for x64 and ARM64 are identical
- Only one set is needed
- GPO files in pipeline are copies of files in source
## Installer Debugging
- Can only build installer in Release mode
- Typically debug using logs and message boxes
- Logs located in:
- `%LOCALAPPDATA%\Temp\PowerToys_bootstrapper_*.log` - MSI tool logs
- `%LOCALAPPDATA%\Temp\PowerToys_*.log` - Custom installer logs
- Logs in Bug Reports are useful for troubleshooting installation issues
### Building PowerToys Locally
[Doc] Add doc for a script to build installer locally, and doc for testing winget install locally (#40805) <!-- 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 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: #xxx - [ ] **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 1. Add instructions to build installer locally with a script 2. Add doc explaining how to install an installer by winget locally. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
2025-07-31 09:48:24 +08:00
#### One stop script for building installer
1. Open developer powershell for vs 2022
2. Run tools\build\build-installer.ps1
> For the first-time setup, please run the installer as an administrator. This ensures that the Wix tool can move wix.target to the desired location and trust the certificate used to sign the MSIX packages.
The following manual steps will not install the MSIX apps (such as Command Palette) on your local installer.
#### Prerequisites for building the MSI installer
Remove WiX v3 infrastructure and migrate exclusively to WiX v5 (#41975) ## Summary: This pull request refactors the installer build pipeline to simplify and modernize the process, focusing exclusively on the WiX 5 (VNext) installer and removing legacy WiX 3 support. It eliminates the use of the `installerSuffix` parameter and related logic, removes the legacy installer build steps and scripts, and updates documentation to reflect the new architecture. The changes streamline the pipeline, reduce complexity, and ensure only the latest installer is built and signed. Pipeline and build system simplification: * Removed the `installerSuffix` parameter and all related logic from pipeline templates and YAML files, including file naming, build steps, and hash calculation scripts. * Removed legacy WiX 3 installer build steps and the associated script `installWiX.ps1`, focusing exclusively on WiX 5 (VNext) installer builds. Installer signing and build process updates: * Updated `.pipelines/ESRPSigning_installer.json` to remove signing configuration for the legacy `PowerToysSetupCustomActions.dll`, ensuring only the VNext DLL is signed. Documentation updates: * Updated `doc/devdocs/core/installer.md` to remove references to WiX 3, clarify the installer architecture as WiX 5 only, and describe the new build process. ## CheckList: - [ ] Should Build successfully and produce installer for both per user and per machine - [ ] Should install without problem --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vanzue <69313318+vanzue@users.noreply.github.com> Co-authored-by: Kai Tao (from Dev Box) <kaitao@microsoft.com>
2025-10-16 16:39:50 -07:00
PowerToys uses WiX v5 for creating installers. The WiX v5 tools are automatically installed during the build process via dotnet tool.
For manual installation of WiX v5 tools:
```powershell
dotnet tool install --global wix --version 5.0.2
```
> **Note:** As of release 0.94, PowerToys has migrated from WiX v3 to WiX v5. The WiX v3 toolset is no longer required.
#### Building prerequisite projects
##### From the command line
1. From the start menu, open a `Developer Command Prompt for VS 2022`
1. Ensure `nuget.exe` is in your `%path%`
1. In the repo root, run these commands:
```
nuget restore .\tools\BugReportTool\BugReportTool.sln
msbuild -p:Platform=x64 -p:Configuration=Release .\tools\BugReportTool\BugReportTool.sln
nuget restore .\tools\StylesReportTool\StylesReportTool.sln
msbuild -p:Platform=x64 -p:Configuration=Release .\tools\StylesReportTool\StylesReportTool.sln
```
##### From Visual Studio
If you prefer, you can alternatively build prerequisite projects for the installer using the Visual Studio UI.
1. Open `tools\BugReportTool\BugReportTool.sln`
1. In Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`
1. From the `Build` menu, choose `Build Solution`.
1. Open `tools\StylesReportTool\StylesReportTool.sln`
1. In Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`
1. From the `Build` menu, choose `Build Solution`.
#### Locally compiling the installer
1. Open `installer\PowerToysSetup.sln`
1. In Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`
1. From the `Build` menu choose `Build Solution`.
Remove WiX v3 infrastructure and migrate exclusively to WiX v5 (#41975) ## Summary: This pull request refactors the installer build pipeline to simplify and modernize the process, focusing exclusively on the WiX 5 (VNext) installer and removing legacy WiX 3 support. It eliminates the use of the `installerSuffix` parameter and related logic, removes the legacy installer build steps and scripts, and updates documentation to reflect the new architecture. The changes streamline the pipeline, reduce complexity, and ensure only the latest installer is built and signed. Pipeline and build system simplification: * Removed the `installerSuffix` parameter and all related logic from pipeline templates and YAML files, including file naming, build steps, and hash calculation scripts. * Removed legacy WiX 3 installer build steps and the associated script `installWiX.ps1`, focusing exclusively on WiX 5 (VNext) installer builds. Installer signing and build process updates: * Updated `.pipelines/ESRPSigning_installer.json` to remove signing configuration for the legacy `PowerToysSetupCustomActions.dll`, ensuring only the VNext DLL is signed. Documentation updates: * Updated `doc/devdocs/core/installer.md` to remove references to WiX 3, clarify the installer architecture as WiX 5 only, and describe the new build process. ## CheckList: - [ ] Should Build successfully and produce installer for both per user and per machine - [ ] Should install without problem --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vanzue <69313318+vanzue@users.noreply.github.com> Co-authored-by: Kai Tao (from Dev Box) <kaitao@microsoft.com>
2025-10-16 16:39:50 -07:00
The resulting installer will be available in the `installer\PowerToysSetupVNext\x64\Release\` folder.
[Installer] Upgrade the installer from WiX3 to WiX5 (#40877) <!-- 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 Background: The current PowerToys installer is built using Wix3, which has now been deprecated. To improve security, service quality, and community support, we’re upgrading the installer to Wix5. Implementation: Created Wix5-based projects(PowerToysSetupVext and PowerToysSetupCustomActionsVNext) within the installer while retaining the existing Wix3 project. Both versions are built to generate separate installation packages. The Wix3-related code will be removed after successful release testing confirms no issues. Special case: Wix5 has removed the property for 'ShowFilesInUse'. Now, whenever a file is in use during installation, a FilesInUse pop-upwill automatically appear asking for the next step. To ensure this doesn't interfere with scenarios that require silent installation (e.g. Winget method), we’ve handled it using the bafunction approach. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: #xxx - [ ] **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 --------- Co-authored-by: Jerry Xu <n.xu@outlook.com> Co-authored-by: Kai Tao <69313318+vanzue@users.noreply.github.com> Co-authored-by: leileizhang <leilzh@microsoft.com> Co-authored-by: Kai Tao (from Dev Box) <kaitao@microsoft.com> Co-authored-by: vanzue <vanzue@outlook.com>
2025-08-25 18:39:11 +08:00
Remove WiX v3 infrastructure and migrate exclusively to WiX v5 (#41975) ## Summary: This pull request refactors the installer build pipeline to simplify and modernize the process, focusing exclusively on the WiX 5 (VNext) installer and removing legacy WiX 3 support. It eliminates the use of the `installerSuffix` parameter and related logic, removes the legacy installer build steps and scripts, and updates documentation to reflect the new architecture. The changes streamline the pipeline, reduce complexity, and ensure only the latest installer is built and signed. Pipeline and build system simplification: * Removed the `installerSuffix` parameter and all related logic from pipeline templates and YAML files, including file naming, build steps, and hash calculation scripts. * Removed legacy WiX 3 installer build steps and the associated script `installWiX.ps1`, focusing exclusively on WiX 5 (VNext) installer builds. Installer signing and build process updates: * Updated `.pipelines/ESRPSigning_installer.json` to remove signing configuration for the legacy `PowerToysSetupCustomActions.dll`, ensuring only the VNext DLL is signed. Documentation updates: * Updated `doc/devdocs/core/installer.md` to remove references to WiX 3, clarify the installer architecture as WiX 5 only, and describe the new build process. ## CheckList: - [ ] Should Build successfully and produce installer for both per user and per machine - [ ] Should install without problem --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vanzue <69313318+vanzue@users.noreply.github.com> Co-authored-by: Kai Tao (from Dev Box) <kaitao@microsoft.com>
2025-10-16 16:39:50 -07:00
To build the installer from the command line, run `Developer Command Prompt for VS 2022` in admin mode and execute the following commands. The generated installer package will be located at `\installer\PowerToysSetupVNext\{platform}\Release\MachineSetup`.
[Installer] Upgrade the installer from WiX3 to WiX5 (#40877) <!-- 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 Background: The current PowerToys installer is built using Wix3, which has now been deprecated. To improve security, service quality, and community support, we’re upgrading the installer to Wix5. Implementation: Created Wix5-based projects(PowerToysSetupVext and PowerToysSetupCustomActionsVNext) within the installer while retaining the existing Wix3 project. Both versions are built to generate separate installation packages. The Wix3-related code will be removed after successful release testing confirms no issues. Special case: Wix5 has removed the property for 'ShowFilesInUse'. Now, whenever a file is in use during installation, a FilesInUse pop-upwill automatically appear asking for the next step. To ensure this doesn't interfere with scenarios that require silent installation (e.g. Winget method), we’ve handled it using the bafunction approach. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: #xxx - [ ] **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 --------- Co-authored-by: Jerry Xu <n.xu@outlook.com> Co-authored-by: Kai Tao <69313318+vanzue@users.noreply.github.com> Co-authored-by: leileizhang <leilzh@microsoft.com> Co-authored-by: Kai Tao (from Dev Box) <kaitao@microsoft.com> Co-authored-by: vanzue <vanzue@outlook.com>
2025-08-25 18:39:11 +08:00
```
git clean -xfd -e *exe -- .\installer\
MSBuild -t:restore .\installer\PowerToysSetup.sln -p:RestorePackagesConfig=true /p:Platform="x64" /p:Configuration=Release
MSBuild -t:Restore -m .\installer\PowerToysSetup.sln /t:PowerToysInstallerVNext /p:Configuration=Release /p:Platform="x64"
MSBuild -t:Restore -m .\installer\PowerToysSetup.sln /t:PowerToysBootstrapperVNext /p:Configuration=Release /p:Platform="x64"
```
### Supported arguments for the .EXE Bootstrapper installer
Head over to the wiki to see the [full list of supported installer arguments][installerArgWiki].
[installerArgWiki]: https://github.com/microsoft/PowerToys/wiki/Installer-arguments