mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01: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>
2.5 KiB
2.5 KiB
Build scripts – quick guideline
Use these scripts to build PowerToys locally. They auto-detect your platform (x64/arm64), initialize the Visual Studio developer environment, and write helpful logs on failure.
Quick start (from cmd.exe)
- Fast essentials (runner + settings) and NuGet restore first:
tools\build\build-essentials.cmd
- Build projects in the current folder:
tools\build\build.cmd
Tip: Add D:\PowerToys\tools\build to your PATH to use the wrappers anywhere.
When to use which
-
build-essentials.ps1- Restores NuGet for
PowerToys.slnxand builds essentials (runner, settings). - Auto-detects Platform; initializes VS Dev environment automatically.
- Example (PowerShell):
./tools/build/build-essentials.ps1./tools/build/build-essentials.ps1 -Platform arm64 -Configuration Release
- Restores NuGet for
-
build.ps1(from any folder)- Builds any
.sln/.csproj/.vcxprojin the current directory. - Auto-detects Platform; initializes VS Dev environment automatically.
- Accepts extra MSBuild args (forwarded to msbuild):
./tools/build/build.ps1 '/p:CIBuild=true' '/p:SomeProp=Value'
- Restore only:
./tools/build/build.ps1 -RestoreOnly
- Builds any
-
build-installer.ps1(use with caution)- Full local packaging pipeline (restore, build, sign MSIX, WiX v5 MSI/bootstrapper).
- Auto-inits VS Dev environment. Cleans some output (keeps *.exe) under
installer/. - Key options:
-PerUser true|false,-InstallerSuffix wix5|vnext. - Example:
./tools/build/build-installer.ps1 -Platform x64 -Configuration Release -PerUser true -InstallerSuffix wix5
Logs and troubleshooting
- On failure, see logs next to the solution/project being built:
build.<configuration>.<platform>.all.log— full text logbuild.<configuration>.<platform>.errors.log— errors onlybuild.<configuration>.<platform>.warnings.log— warnings onlybuild.<configuration>.<platform>.trace.binlog— open with MSBuild Structured Log Viewer
- VS environment init:
- Scripts try DevShell first (
Microsoft.VisualStudio.DevShell.dll/Enter-VsDevShell), then fall back toVsDevCmd.bat. - If VS isn't found, run from "Developer PowerShell for VS 2022" or "Developer PowerShell for VS", or ensure
vswhere.exeexists underProgram Files (x86)\Microsoft Visual Studio\Installer.
- Scripts try DevShell first (
Notes
- Override platform explicitly with
-Platform x64|arm64if needed. - CMD wrappers:
build.cmd,build-essentials.cmdforward all arguments to the PowerShell scripts.