Files
PowerToys/tools/build/BUILD-GUIDELINES.md
Dustin L. Howett dc30f3fd8e build: move main and setup to SLNX (#43478)
Closes #37100

This does not migrate the rest of the solutions (why do we have so
many?)

Not migrated:

- TemplateCmdPalExtension.sln
- FancyZonesEditor.sln
- BugReportTool.sln
- CleanUp_tool.sln
- FancyZones_DrawLayoutTest.sln
- FancyZones_zonable_tester.sln
- FancyZone_HitTest.sln
- MonitorReportTool.sln
- PowerToyTemplate.sln
- StylesReportTool.sln

---------

Co-authored-by: vanzue <vanzue@outlook.com>
2025-12-03 17:59:46 +08:00

49 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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
1) `build-essentials.ps1`
- Restores NuGet for `PowerToys.slnx` and 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`
2) `build.ps1` (from any folder)
- Builds any `.sln/.csproj/.vcxproj` in 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`
3) `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 log
- `build.<configuration>.<platform>.errors.log` — errors only
- `build.<configuration>.<platform>.warnings.log` — warnings only
- `build.<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 to `VsDevCmd.bat`.
- If VS isnt found, run from “Developer PowerShell for VS 2022”, or ensure `vswhere.exe` exists under `Program Files (x86)\Microsoft Visual Studio\Installer`.
## Notes
- Override platform explicitly with `-Platform x64|arm64` if needed.
- CMD wrappers: `build.cmd`, `build-essentials.cmd` forward all arguments to the PowerShell scripts.