Gavin 北稱 1703e7ac09 [Build] Fix UTF-8 and output paths for local C++ builds (#49575)
## Summary of the Pull Request

Fixes two local C++ build reliability problems:

- Compiles all PowerToys C++ projects as UTF-8 through
`Cpp.Build.props`, so builds do not depend on the active Windows code
page. On code page 936, UTF-8 punctuation in BOM-less source files
otherwise triggers C4819 and fails the build because warnings are
treated as errors.
- Uses `$(RepoRoot)` for Keyboard Manager repository paths and
standardizes native/test output directories. This makes direct project
builds find the resource conversion script and headers, places the
Editor wrapper beside the WinUI app, and keeps the Engine test DLL under
the repository test output directory.

No runtime logic, end-user strings, dependencies, or binaries are added.

## PR Checklist

- [x] Closes: #49573
- [x] Closes: #49574
- [x] **Communication:** Discussed the shared UTF-8 policy with a
PowerToys collaborator in this PR
- [x] **Tests:** Existing Keyboard Manager Engine tests pass; no new
tests are needed for project-only changes
- [x] **Localization:** No end-user-facing strings are changed
- [x] **Dev docs:** No documentation changes are required for project
configuration fixes
- [x] **New binaries:** No new binaries are added
- [x] **Documentation updated:** No user documentation changes are
required

## Detailed Description of the Pull Request / Additional comments

`Directory.Build.props` imports `Cpp.Build.props` for C++ projects.
Defining `/utf-8 %(AdditionalOptions)` in its shared `ClCompile`
settings makes source decoding deterministic across the native codebase
and prevents future BOM-less UTF-8 source files from reintroducing the
same locale-dependent failure. `/utf-8` explicitly sets both the source
and execution character sets instead of suppressing C4819 or replacing
valid Unicode text.

`$(SolutionDir)` is only reliable when MSBuild is invoked through a
solution. The repository's local build script builds `.vcxproj` files
directly from their project directories, where `$(RepoRoot)` is the
stable repository root property. The wrapper output now follows the
existing `$(RepoRoot)$(Platform)\$(Configuration)\WinUI3Apps\` pattern
used by other native WinUI dependencies.

## Validation Steps Performed

All successful builds used the repository build scripts with `-Platform
x64 -Configuration Debug`.

- Ran `tools/build/build-essentials.cmd`: solution restore, Runner, and
Settings all succeeded with empty errors logs.
- Built `FancyZonesLib` successfully after it had failed with a
resource-related CL exit during a full parallel build.
- Built `WorkspacesModuleInterface` successfully, validating that
existing UTF-16 BOM headers remain compatible with the shared option.
- Built `ZoomItBreak` and `ZoomIt` successfully.
- Built `KeyboardManagerEngineTest` successfully.
- Built `KeyboardManagerEditor` and `KeyboardManagerEditorUI`
successfully after the documented essentials prerequisite.
- Confirmed the successful native build logs contain `/utf-8` compiler
invocations and all corresponding `build.debug.x64.errors.log` files are
empty.
- Ran `vstest.console.exe` against the Keyboard Manager Engine test
assembly: 103/103 passed.
- Confirmed `PowerToys.KeyboardManagerEditorLibraryWrapper.dll` is
emitted to `x64/Debug/WinUI3Apps`.
- Confirmed `KeyboardManager.Engine.UnitTests.dll` is emitted to
`x64/Debug/tests/KeyboardManagerEngine`.
- Previously manually verified the x64 Debug PowerToys build can open
Keyboard Manager Editor without 0x8007007E.

A full `PowerToys.slnx` x64 Debug build was attempted twice. The first
attempt exhausted the remaining 62 MB of disk space. After clearing
52.46 GB of ignored build outputs, the second attempt still exceeded the
machine's temporary disk/commit limits (`CL.exe` exit `0xC000012D` and
an out-of-space cppwinrt write). Before that resource failure, the log
contained 4,642 `/utf-8` command entries and no character-set
diagnostics. The full configuration matrix is left to PR CI rather than
bypassing normal build settings locally.

---------

Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
2026-08-05 08:10:36 +00:00
2026-02-11 22:59:53 +01:00
2026-07-30 22:42:05 -07:00
2022-07-19 13:06:16 -07:00
2020-03-05 10:11:27 -08:00
2020-05-02 15:59:18 -07:00
2026-02-14 15:47:56 +08:00

Microsoft PowerToys

Microsoft PowerToys is a collection of utilities that help you customize Windows and streamline everyday tasks.

Installation · Documentation · Blog · Release notes

🔨 Utilities

PowerToys includes over 30 utilities to help you customize and optimize your Windows experience:

Advanced Paste icon Advanced Paste Always on Top icon Always on Top Awake icon Awake
Color Picker icon Color Picker Command Not Found icon Command Not Found Command Palette icon Command Palette
Crop and Lock icon Crop And Lock Environment Variables icon Environment Variables FancyZones icon FancyZones
File Explorer Add-ons icon File Explorer Add-ons File Locksmith icon File Locksmith Grab And Move icon Grab And Move
Hosts File Editor icon Hosts File Editor Image Resizer icon Image Resizer Keyboard Manager icon Keyboard Manager
Light Switch icon Light Switch Mouse Utilities icon Mouse Utilities Mouse Without Borders icon Mouse Without Borders
New+ icon New+ Peek icon Peek PowerDisplay icon PowerDisplay
PowerRename icon PowerRename PowerToys Run icon PowerToys Run Quick Accent icon Quick Accent
Registry Preview icon Registry Preview Screen Ruler icon Screen Ruler Shortcut Guide icon Shortcut Guide
Text Extractor icon Text Extractor Workspaces icon Workspaces ZoomIt icon ZoomIt

📦 Installation

For detailed installation instructions and system requirements, visit the installation docs.

But to get started quickly, choose one of the installation methods below:

Download the .exe file from GitHub

Go to the PowerToys GitHub releases, scroll down and select Assets to reveal the installation files, and choose the one that matches your architecture and install scope. For most devices, that would be x64 per-user.

Microsoft Store
You can easily install PowerToys from the Microsoft Store:

WinGet
Download PowerToys from [WinGet](https://github.com/microsoft/winget-cli#installing-the-client). Updating PowerToys via winget will respect the current PowerToys installation scope. To install PowerToys, run the following command from the command line / PowerShell:
  • User scope installer (default)
winget install Microsoft.PowerToys -s winget
  • Machine-wide scope installer
winget install --scope machine Microsoft.PowerToys -s winget
Other methods
There are [community driven install methods](https://learn.microsoft.com/windows/powertoys/install#community-driven-install-tools) such as Chocolatey and Scoop. If these are your preferred install solutions, you can find the install instructions there.

What's new?

What's new image

To see what's new, check out the release notes.

🛣️ Roadmap

We are planning some nice new features and improvements for the next releases a brand-new Shortcut Guide experience, ensuring it's easier to find and install Command Palette extensions and so much more! Stay tuned for v0.100!

❤️ PowerToys Community

The PowerToys team is extremely grateful to have the support of an amazing active community. The work you do is incredibly important. PowerToys wouldn't be nearly what it is today without your help filing bugs, updating documentation, guiding the design, or writing features. We want to say thank you and take time to recognize your work. Your contributions and feedback improve PowerToys month after month!

Contributing

This project welcomes contributions of all types. Besides coding features / bug fixes, other ways to assist include spec writing, design, documentation, and finding bugs. We are excited to work with the power user community to build a set of tools for helping you get the most out of Windows. We ask that before you start work on a feature that you would like to contribute, please read our Contributor's Guide. We would be happy to work with you to figure out the best approach, provide guidance and mentorship throughout feature development, and help avoid any wasted or duplicate effort. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you grant us the rights to use your contribution and that you have permission to do so. For guidance on developing for PowerToys, please read the developer docs for a detailed breakdown. This includes how to setup your computer to compile.

Code of conduct

This project has adopted the Microsoft Open Source Code of Conduct.

Privacy statement

The application logs basic diagnostic data (telemetry). For more privacy information and what we collect, see our PowerToys Data and Privacy documentation.

Description
Microsoft PowerToys is a collection of utilities that help you customize Windows and streamline everyday tasks
Readme MIT 734 MiB
Languages
C 45.1%
C# 26.1%
JavaScript 14.1%
C++ 13.8%
PowerShell 0.6%
Other 0.2%