mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 12:46:47 +02:00
<!-- 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 PR updates the PowerToys solution to support **Visual Studio 2026 (PlatformToolset v145)**. It centralizes the build configuration, updates the C++ language standards, and fixes an issue with a MouseJump unit test that appears while using the VS 2026 supported build agent. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: #xxx - [x] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [x] **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 **Build System & Configuration:** - Updated `Cpp.Build.props` to use `v145` (VS 2026) as the default `PlatformToolset`, with fall back to `v143` for VS 2022. - Configured C++ Language Standard: - `stdcpplatest` for production projects. - Removed explicit `<PlatformToolset>` definitions from individual project files (approx. 37 modules) to inherit correctly from the central `Cpp.Build.props`. **Code Refactoring & Fixes:** - Updated `DrawingHelperTests.cs` in MouseJump Unit Test to ease the pixel difference tolerance. This became an issue after switching to the new VS2026 build agent. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Validated successful compilation of the entire solution. Similar updates have been made to the .NET 10 branch, but these are much cleaner and will be merged into that branch once fully confirmed working. --------- Co-authored-by: Kai Tao (from Dev Box) <kaitao@microsoft.com> Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com>
216 lines
9.2 KiB
YAML
216 lines
9.2 KiB
YAML
parameters:
|
|
- name: versionNumber
|
|
type: string
|
|
default: "0.0.1"
|
|
- name: codeSign
|
|
type: boolean
|
|
default: false
|
|
- name: signingIdentity
|
|
type: object
|
|
default: {}
|
|
- name: additionalBuildOptions
|
|
type: string
|
|
default: ''
|
|
|
|
steps:
|
|
# Install WiX 5.0.2 tools needed for VNext installer (matching project SDK)
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Install WiX 5.0.2 tools
|
|
inputs:
|
|
command: 'custom'
|
|
custom: 'tool'
|
|
arguments: 'install --global wix --version 5.0.2'
|
|
|
|
- pwsh: |-
|
|
Write-Host "##vso[task.setvariable variable=InstallerMachineRoot]installer\PowerToysSetupVNext\$(BuildPlatform)\$(BuildConfiguration)\MachineSetup"
|
|
Write-Host "##vso[task.setvariable variable=InstallerUserRoot]installer\PowerToysSetupVNext\$(BuildPlatform)\$(BuildConfiguration)\UserSetup"
|
|
Write-Host "##vso[task.setvariable variable=InstallerMachineBasename]PowerToysSetup-${{ parameters.versionNumber }}-$(BuildPlatform)"
|
|
Write-Host "##vso[task.setvariable variable=InstallerUserBasename]PowerToysUserSetup-${{ parameters.versionNumber }}-$(BuildPlatform)"
|
|
displayName: Prepare Installer variables
|
|
|
|
# This dll needs to be built and signed before building the MSI.
|
|
# The Custom Actions project contains a pre-build event that prepares the .wxs files
|
|
# by filling them out with all our components. We pass RunBuildEvents=true to force
|
|
# that logic to run.
|
|
- task: VSBuild@1
|
|
displayName: Build Shared Support DLLs
|
|
inputs:
|
|
solution: "**/installer/PowerToysSetup.slnx"
|
|
vsVersion: 18.0
|
|
msbuildArgs: >-
|
|
/t:PowerToysSetupCustomActionsVNext;SilentFilesInUseBAFunction
|
|
/p:RunBuildEvents=true;RestorePackagesConfig=true;CIBuild=true
|
|
-restore -graph
|
|
/bl:$(LogOutputDirectory)\installer-actions.binlog
|
|
${{ parameters.additionalBuildOptions }}
|
|
platform: $(BuildPlatform)
|
|
configuration: $(BuildConfiguration)
|
|
clean: true
|
|
msbuildArchitecture: x64
|
|
maximumCpuCount: true
|
|
|
|
- ${{ if eq(parameters.codeSign, true) }}:
|
|
- template: steps-esrp-sign-files-authenticode.yml
|
|
parameters:
|
|
displayName: Sign Shared Support DLLs
|
|
signingIdentity: ${{ parameters.signingIdentity }}
|
|
folder: 'installer'
|
|
pattern: |-
|
|
**/PowerToysSetupCustomActionsVNext.dll
|
|
**/SilentFilesInUseBAFunction.dll
|
|
|
|
## INSTALLER START
|
|
#### MSI BUILDING AND SIGNING
|
|
#
|
|
# The MSI build contains code that reverts the .wxs files to their in-tree versions.
|
|
# This is only supposed to happen during local builds. Since this build system is
|
|
# supposed to run side by side--machine and then user--we do NOT want to destroy
|
|
# the .wxs files. Therefore, we pass RunBuildEvents=false to suppress all of that
|
|
# logic.
|
|
#
|
|
# We pass BuildProjectReferences=false so that it does not recompile the DLLs we just built.
|
|
# We only pass -restore on the first one because the second run should already have all
|
|
# of the dependencies.
|
|
- task: VSBuild@1
|
|
displayName: 💻 Build VNext MSI
|
|
inputs:
|
|
solution: "**/installer/PowerToysSetup.slnx"
|
|
vsVersion: 18.0
|
|
msbuildArgs: >-
|
|
-restore
|
|
/t:PowerToysInstallerVNext
|
|
/p:RunBuildEvents=false;PerUser=false;BuildProjectReferences=false;CIBuild=true
|
|
/bl:$(LogOutputDirectory)\installer-machine-msi.binlog
|
|
${{ parameters.additionalBuildOptions }}
|
|
platform: $(BuildPlatform)
|
|
configuration: $(BuildConfiguration)
|
|
clean: false # don't undo our hard work above by deleting the CustomActions dll
|
|
msbuildArchitecture: x64
|
|
maximumCpuCount: true
|
|
|
|
- task: VSBuild@1
|
|
displayName: 👤 Build VNext MSI
|
|
inputs:
|
|
solution: "**/installer/PowerToysSetup.slnx"
|
|
vsVersion: 18.0
|
|
msbuildArgs: >-
|
|
/t:PowerToysInstallerVNext
|
|
/p:RunBuildEvents=false;PerUser=true;BuildProjectReferences=false;CIBuild=true
|
|
/bl:$(LogOutputDirectory)\installer-user-msi.binlog
|
|
${{ parameters.additionalBuildOptions }}
|
|
platform: $(BuildPlatform)
|
|
configuration: $(BuildConfiguration)
|
|
clean: false # don't undo our hard work above by deleting the CustomActions dll
|
|
msbuildArchitecture: x64
|
|
maximumCpuCount: true
|
|
|
|
- script: |-
|
|
wix msi decompile $(InstallerMachineRoot)\$(InstallerMachineBasename).msi -x $(build.sourcesdirectory)\extractedMachineMsi
|
|
wix msi decompile $(InstallerUserRoot)\$(InstallerUserBasename).msi -x $(build.sourcesdirectory)\extractedUserMsi
|
|
dir $(build.sourcesdirectory)\extractedMachineMsi
|
|
dir $(build.sourcesdirectory)\extractedUserMsi
|
|
displayName: "WiX5: Extract and verify MSIs"
|
|
|
|
# Check if deps.json files don't reference different dll versions.
|
|
- pwsh: |-
|
|
& '.pipelines/verifyDepsJsonLibraryVersions.ps1' -targetDir '$(build.sourcesdirectory)\extractedMachineMsi\File'
|
|
& '.pipelines/verifyDepsJsonLibraryVersions.ps1' -targetDir '$(build.sourcesdirectory)\extractedUserMsi\File'
|
|
displayName: Audit deps.json in MSI extracted files
|
|
|
|
- ${{ if eq(parameters.codeSign, true) }}:
|
|
- pwsh: |-
|
|
& .pipelines/versionAndSignCheck.ps1 -targetDir '$(build.sourcesdirectory)\extractedMachineMsi\File'
|
|
& .pipelines/versionAndSignCheck.ps1 -targetDir '$(build.sourcesdirectory)\extractedMachineMsi\Binary'
|
|
& .pipelines/versionAndSignCheck.ps1 -targetDir '$(build.sourcesdirectory)\extractedUserMsi\File'
|
|
& .pipelines/versionAndSignCheck.ps1 -targetDir '$(build.sourcesdirectory)\extractedUserMsi\Binary'
|
|
git clean -xfd ./extractedMachineMsi ./extractedUserMsi
|
|
displayName: Verify all binaries are signed and versioned
|
|
|
|
- template: steps-esrp-sign-files-authenticode.yml
|
|
parameters:
|
|
displayName: Sign VNext MSIs
|
|
signingIdentity: ${{ parameters.signingIdentity }}
|
|
folder: 'installer'
|
|
pattern: '**/PowerToys*Setup-*.msi'
|
|
|
|
#### END MSI
|
|
|
|
#### BOOTSTRAP BUILDING AND SIGNING
|
|
# We pass BuildProjectReferences=false so that it does not recompile the DLLs we just built.
|
|
# We only pass -restore on the first one because the second run should already have all
|
|
# of the dependencies.
|
|
- task: VSBuild@1
|
|
displayName: 💻 Build VNext Bootstrapper
|
|
inputs:
|
|
solution: "**/installer/PowerToysSetup.slnx"
|
|
vsVersion: 18.0
|
|
msbuildArgs: >-
|
|
-restore
|
|
/t:PowerToysBootstrapperVNext
|
|
/p:PerUser=false;BuildProjectReferences=false;CIBuild=true
|
|
/bl:$(LogOutputDirectory)\installer-machine-bootstrapper.binlog
|
|
${{ parameters.additionalBuildOptions }}
|
|
platform: $(BuildPlatform)
|
|
configuration: $(BuildConfiguration)
|
|
clean: false # don't undo our hard work above by deleting the MSI nor SilentFilesInUseBAFunction
|
|
msbuildArchitecture: x64
|
|
maximumCpuCount: true
|
|
|
|
- task: VSBuild@1
|
|
displayName: 👤 Build VNext Bootstrapper
|
|
inputs:
|
|
solution: "**/installer/PowerToysSetup.slnx"
|
|
vsVersion: 18.0
|
|
msbuildArgs: >-
|
|
/t:PowerToysBootstrapperVNext
|
|
/p:PerUser=true;BuildProjectReferences=false;CIBuild=true
|
|
/bl:$(LogOutputDirectory)\installer-user-bootstrapper.binlog
|
|
${{ parameters.additionalBuildOptions }}
|
|
platform: $(BuildPlatform)
|
|
configuration: $(BuildConfiguration)
|
|
clean: false # don't undo our hard work above by deleting the MSI nor SilentFilesInUseBAFunction
|
|
msbuildArchitecture: x64
|
|
maximumCpuCount: true
|
|
|
|
# The entirety of bundle unpacking/re-packing is unnecessary if we are not code signing it.
|
|
- ${{ if eq(parameters.codeSign, true) }}:
|
|
- script: |-
|
|
wix burn detach $(InstallerMachineRoot)\$(InstallerMachineBasename).exe -engine installer\machine-engine.exe
|
|
wix burn detach $(InstallerUserRoot)\$(InstallerUserBasename).exe -engine installer\user-engine.exe
|
|
displayName: "WiX5: Extract Engines from Bundles"
|
|
|
|
- template: steps-esrp-sign-files-authenticode.yml
|
|
parameters:
|
|
displayName: Sign WiX Engines
|
|
signingIdentity: ${{ parameters.signingIdentity }}
|
|
folder: "installer"
|
|
pattern: '*-engine.exe'
|
|
|
|
- script: |-
|
|
wix burn reattach $(InstallerMachineRoot)\$(InstallerMachineBasename).exe -engine installer\machine-engine.exe -o $(InstallerMachineRoot)\$(InstallerMachineBasename).exe
|
|
wix burn reattach $(InstallerUserRoot)\$(InstallerUserBasename).exe -engine installer\user-engine.exe -o $(InstallerUserRoot)\$(InstallerUserBasename).exe
|
|
displayName: "WiX5: Reattach Engines to Bundles"
|
|
|
|
- pwsh: |-
|
|
& wix burn extract -oba installer\ba\m "$(InstallerMachineRoot)\$(InstallerMachineBasename).exe"
|
|
& wix burn extract -oba installer\ba\u "$(InstallerUserRoot)\$(InstallerUserBasename).exe"
|
|
Get-ChildItem installer\ba -Recurse -Include *.exe,*.dll | Get-AuthenticodeSignature | ForEach-Object {
|
|
If ($_.Status -Ne "Valid") {
|
|
Write-Error $_.StatusMessage
|
|
} Else {
|
|
Write-Host $_.StatusMessage
|
|
}
|
|
}
|
|
& git clean -fdx installer\ba
|
|
displayName: "WiX5: Verify Bootstrapper content is signed"
|
|
|
|
- template: steps-esrp-sign-files-authenticode.yml
|
|
parameters:
|
|
displayName: Sign Final Bootstrappers
|
|
signingIdentity: ${{ parameters.signingIdentity }}
|
|
folder: 'installer'
|
|
pattern: '**/PowerToys*Setup-*.exe'
|
|
|
|
#### END BOOTSTRAP
|
|
## END INSTALLER
|