From 2250e68b5e9bac3637f62ef1507096943bc668eb Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 30 Nov 2026 23:50:49 -0800 Subject: [PATCH 1/3] Bump tooling submodule to ai-ready-repo-instructions branch (PR #324) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- tooling | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tooling b/tooling index 5668ff29..499fca65 160000 --- a/tooling +++ b/tooling @@ -1 +1 @@ -Subproject commit 5668ff2902fb91c780d30ff215202eead21d8593 +Subproject commit 499fca6579aeb48a8bfb08b997f2b11bf57895e4 From 26f48cba2a94878cca89ab187b404eeb73b16f4e Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 1 Dec 2026 00:20:02 -0800 Subject: [PATCH 2/3] Add Copilot repository instructions and validation skill Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/copilot-instructions.md | 26 ++++++++++ .../instructions/components.instructions.md | 20 ++++++++ .../validate-component-changes/SKILL.md | 47 +++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 .github/copilot-instructions.md create mode 100644 .github/instructions/components.instructions.md create mode 100644 .github/skills/validate-component-changes/SKILL.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..72a7d2be --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,26 @@ +# Copilot instructions: Windows Community Toolkit + +Stable WinUI components (`components//{src,samples,tests}`) shipped as `CommunityToolkit.Uwp.*` (UWP, WinUI 2) and `CommunityToolkit.WinUI.*` (Windows App SDK and Uno, WinUI 3) NuGet packages. The build system, sample/test heads, generators and scripts live in the `tooling/` git submodule; this repo is the consumer layout they are designed for, so tooling scripts run in place here. + +## Tooling docs (not auto-loaded) +Copilot only loads `.github` from this repo root, so read these explicitly: +- `tooling/.github/copilot-instructions.md`: before editing any code or build file (it has the conditional-compilation, MSBuild-condition and license-header rules). +- `tooling/.github/instructions/multitarget.instructions.md`: before touching `MultiTarget.props`, `Dependencies.props` conditions, TFMs, identity properties or package ids. +- `tooling/.github/instructions/powershell-scripts.instructions.md`: before running any tooling script (side effects, prompts that hang, exit code 0 on failure). +- `tooling/.github/instructions/dotnet-templates.instructions.md`: when adding a component, test project or sample docs. +- `tooling/.github/instructions/source-generators.instructions.md`, `tooling/.github/skills/validate-in-consumer-layout/SKILL.md`: only for changes *to* tooling, which belong in the tooling repo. + +Inside those files "this repo" means tooling and "consumer repo" means this repo; their "Layout assumption" section and "never run scripts from your checkout" rule do not apply here. To validate changes in this repo use `.github/skills/validate-component-changes`. + +## Build configuration +- Package version is `..` (plus a preview suffix) from `MajorVersion`/`MinorVersion` in the root `Directory.Build.props`. On a `rel/x.y.z[-pre]` branch CI takes only the patch and prerelease parts from the branch name, so `x.y` must match the props. +- Release is the real gate: it adds `TreatWarningsAsErrors` and `EnforceCodeStyleInBuild`; Debug does not (nullable warnings are errors in both). Fix the code rather than adding `NoWarn`, `WarningsNotAsErrors` or pragmas, and don't remove the existing exceptions in the Release group. +- CI job `Xaml-Style-Check` gates the whole `build` matrix. `./ApplyXamlStyling.ps1` with no flags reads `git status`, which collapses a new untracked folder to one entry, so a brand-new component's XAML is skipped: `git add` it first and use `-Staged`. + +## Never +- Commit changes to the tracked `tooling/MultiTarget/EnabledMultiTargets.props` that tooling scripts rewrite (the submodule shows as modified in `git status`): `git -C tooling checkout -- MultiTarget/EnabledMultiTargets.props`. +- Edit files under `tooling/` as part of a change here: they are not part of this repo's commits. Change tooling in its own repo, then bump the submodule pointer as a separate commit; before merging, the pointer must be on a commit that is on tooling `main`. CI hard-codes `tooling/CommunityToolkit.Tooling.SampleGen.Tests/bin/Release/net8.0/...`: a bump that moves it needs a matching workflow edit. +- Hand-edit `catalog/toolkit-samples.json` (generated; see `.github/instructions/components.instructions.md`). +- Remove or rename `ToolkitConvertersSourceProject`, `ToolkitSettingsControlsSourceProject`, `ToolkitExtensionsSourceProject` or `ToolkitTriggersSourceProject`: tooling's sample/test heads silently fall back to a pinned preview NuGet package when they are unset. +- Put MultiTarget- or tooling-dependent logic in the root `Directory.Build.targets`: it also applies to `tools/`, which only isolates itself from the root `Directory.Build.props`. +- Run `GenerateAllSolution.bat` from automation: it passes no `-Launch`, so it opens Visual Studio. Call `tooling/GenerateAllSolution.ps1 ... -Launch $false` instead. diff --git a/.github/instructions/components.instructions.md b/.github/instructions/components.instructions.md new file mode 100644 index 00000000..95f5b46f --- /dev/null +++ b/.github/instructions/components.instructions.md @@ -0,0 +1,20 @@ +--- +applyTo: "components/**,catalog/**,tools/**" +--- +# Components, sample index and `tools/` + +## Components +- Reference sibling components with `$(ToolkitSourceProject)` from the root `Directory.Build.props` (add the property there if it is missing), not relative paths. +- Component projects reference siblings unconditionally, so a component's `` list must be a subset of every referenced component's `src/MultiTarget.props` (e.g. a component that builds for Uno cannot depend on a `uwp;wasdk`-only one). +- Converters, SettingsControls, Extensions and Triggers are compiled into every sample app head (Extensions also into every test head): a break in one of them breaks every head, not just its own component. +- The sample index takes `nugetPackage` from the `src` csproj *file name*, while the real package id comes from `PackageId`. A package whose id contains `.Controls.` (controls: `$(PackageIdPrefix).$(PackageIdVariant).Controls.$(ToolkitComponentName)`) must set `PackageId` explicitly and keep the csproj file name equal to it; the tooling default has no `.Controls`. + +## Sample index (`catalog/toolkit-samples.json`) +`catalog/README.md` describes the file and the `generate`/`check` commands. Easy to miss: +- It is derived from `components/*/samples/**/*.md` (only files with front matter), `*.xaml.cs` (`[ToolkitSample]`), the single csproj in each `src/` and the type/namespace declarations in `components/*/src/**/*.cs` (they narrow `usings`). A pure `src` change can therefore make the index stale. Run `check` after touching any of these and commit the regenerated file with the change. +- An entry id is the slug of the *markdown file name*, must be unique across all components (a collision is an error) and is published as a stable id: renaming a docs file changes it. +- `generate`/`check` report warnings without failing; only errors exit non-zero. +- The exporter and its tests target a runtime older than the SDK in `global.json`. If it is not installed, set `$env:DOTNET_ROLL_FORWARD='Major'` (persists for the session) before `dotnet run`/`dotnet test`. + +## `tools/` +- Platform-agnostic projects that read the repo as text. `tools/Directory.Build.props` is deliberately empty to stop inheriting the root props, and the CI job does not check out `tooling/` or install workloads: they must not reference `tooling/` or WinUI/Uno. diff --git a/.github/skills/validate-component-changes/SKILL.md b/.github/skills/validate-component-changes/SKILL.md new file mode 100644 index 00000000..5717c92a --- /dev/null +++ b/.github/skills/validate-component-changes/SKILL.md @@ -0,0 +1,47 @@ +--- +name: validate-component-changes +description: Build and test changes to components, sample docs/XAML, root props or the sample index in this repo the way CI does (generate solution, Release msbuild, tests, pack, XAML style, sample index). Use before declaring any change under components/, Directory.Build.props/targets, Windows.Toolkit.Common.props, catalog/ or tools/ done. This repo is already the consumer layout, so tooling scripts run in place. +--- + +# Validate changes in this repo + +Mirrors `.github/workflows/build.yml`; run from the repo root on Windows. Read `tooling/.github/instructions/powershell-scripts.instructions.md` first: the scripts have side effects and report failures with exit code 0, so read their output. + +## Prerequisites +- `msbuild.exe` from Visual Studio on `PATH` (Developer shell, or prepend `\MSBuild\Current\Bin\amd64`); otherwise `GenerateSingleSolution.ps1` waits for a keypress. `vstest.console.exe` is in `\Common7\IDE\CommonExtensions\Microsoft\TestWindow` and is on `PATH` only in a Developer shell. +- `dotnet tool restore` once. Workloads and Windows SDK per `ReadMe.md`; the Uno `macos`/`ios`/`android` legs also need the workloads CI installs with `uno-check`. +- If nuget.org is unreachable, patch the feed in `nuget.config` temporarily and never commit it. + +## 1. Fast loop: one component +```powershell +./tooling/ProjectHeads/GenerateSingleSampleHeads.ps1 -MultiTargets wasdk -winui 3 -componentPath $PWD\components\ -Launch $false -IncludeReferencedProjects +msbuild.exe components\\.slnx /restore /nowarn:MSB4011 -p:Configuration=Release /m +``` +Use `-MultiTargets uwp -winui 2` for WinUI 2. Confirm `Generated solution` in the output before building. Without `-IncludeReferencedProjects`, sibling components (Extensions, Triggers, ...) are not in the `.slnx` and get built as **Debug**, so the Release warning gate does not apply to them. + +Tests, as CI runs them (`Tests.Uwp` for WinUI 2): +```powershell +vstest.console.exe (Get-ChildItem components\\heads\Tests.Wasdk -Recurse -Filter *.appxrecipe).FullName /Framework:FrameworkUap10 +``` +The WinAppSdk test host needs the .NET runtime matching the head's TFM; if it is missing, report the tests as not run. + +## 2. Release gate on source projects +```powershell +./tooling/Build-Toolkit-Components.ps1 -Components -MultiTargets wasdk -WinUIMajorVersion 3 -Release -NupkgOutput $env:TEMP\nupkgs +``` +Builds each `src` project (and its dependencies) directly in Release; packs only because `-NupkgOutput` is given. A component that does not support the MultiTarget is skipped with a warning and exit code 0. CI's package job uses `-MultiTargets all` per WinUI version. + +## 3. CI build legs (all components) +One leg per `build.yml` matrix entry (`uwp` with WinUI 2; the rest with WinUI 3): +```powershell +powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -MultiTargets wasdk -WinUIMajorVersion 3 -Launch 0" +msbuild.exe /restore /nowarn:MSB4011 /p:Configuration=Release /m CommunityToolkit.AllComponents.slnx +``` +A cold `wasdk` leg takes a few minutes. After single-component builds, run `git clean -fdX components` first: leftover `samples/bin` output makes the all-components test head fail with `APPX1101` (duplicate `*.xaml` payload). The all-components `uwp` leg finds no component tests (see tooling's multitarget instructions); UWP component tests only run from a single-component solution (step 1). + +## 4. Other CI jobs +- XAML style: `./ApplyXamlStyling.ps1 -Passive` checks every file; to fix your changes, `git add` them and run `./ApplyXamlStyling.ps1 -Staged`. +- Sample index: `dotnet run --project tools/SampleIndexExporter -- check` and `dotnet test tools/SampleIndexExporter.Tests` (runtime note in `.github/instructions/components.instructions.md`). + +## 5. Clean up +Run `dotnet build-server shutdown` first: lingering MSBuild nodes lock `bin`/`obj` and make `git clean` fail partway. Then `git clean -fdX components` (ignored build output, `heads/`, `*.slnx`), delete the root `CommunityToolkit.AllComponents.slnx`, `git -C tooling clean -fdX`, `git -C tooling checkout -- MultiTarget/EnabledMultiTargets.props`, and revert any `nuget.config` patch. `git status` and `git -C tooling status` must show only your intended changes. From 5359f2ca14daa99c8d7ac0f1973400c2656daabe Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 1 Dec 2026 00:47:27 -0800 Subject: [PATCH 3/3] Refine Copilot instructions after adversarial review Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/copilot-instructions.md | 8 +++---- .../instructions/components.instructions.md | 15 ++++++------- .../validate-component-changes/SKILL.md | 21 ++++++++++--------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 72a7d2be..f6f73698 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,25 +1,25 @@ # Copilot instructions: Windows Community Toolkit -Stable WinUI components (`components//{src,samples,tests}`) shipped as `CommunityToolkit.Uwp.*` (UWP, WinUI 2) and `CommunityToolkit.WinUI.*` (Windows App SDK and Uno, WinUI 3) NuGet packages. The build system, sample/test heads, generators and scripts live in the `tooling/` git submodule; this repo is the consumer layout they are designed for, so tooling scripts run in place here. +Stable WinUI components (`components//{src,samples,tests}`) shipped as `CommunityToolkit.Uwp.*` (UWP, WinUI 2) and `CommunityToolkit.WinUI.*` (Windows App SDK and Uno, WinUI 3) NuGet packages. The build system, sample/test heads, generators and scripts live in the `tooling/` git submodule; this repo is the consumer layout they are designed for, so tooling scripts run in place here. New features start in Windows Community Toolkit Labs (`CommunityToolkit/Labs-Windows`); this repo takes fixes and components migrated from Labs (the PR template asks for a link to the migration approval). ## Tooling docs (not auto-loaded) Copilot only loads `.github` from this repo root, so read these explicitly: - `tooling/.github/copilot-instructions.md`: before editing any code or build file (it has the conditional-compilation, MSBuild-condition and license-header rules). - `tooling/.github/instructions/multitarget.instructions.md`: before touching `MultiTarget.props`, `Dependencies.props` conditions, TFMs, identity properties or package ids. - `tooling/.github/instructions/powershell-scripts.instructions.md`: before running any tooling script (side effects, prompts that hang, exit code 0 on failure). -- `tooling/.github/instructions/dotnet-templates.instructions.md`: when adding a component, test project or sample docs. +- `tooling/.github/instructions/dotnet-templates.instructions.md`: when adding a component or adding files to an existing component's tests/samples (test projitems list files by hand). - `tooling/.github/instructions/source-generators.instructions.md`, `tooling/.github/skills/validate-in-consumer-layout/SKILL.md`: only for changes *to* tooling, which belong in the tooling repo. Inside those files "this repo" means tooling and "consumer repo" means this repo; their "Layout assumption" section and "never run scripts from your checkout" rule do not apply here. To validate changes in this repo use `.github/skills/validate-component-changes`. ## Build configuration -- Package version is `..` (plus a preview suffix) from `MajorVersion`/`MinorVersion` in the root `Directory.Build.props`. On a `rel/x.y.z[-pre]` branch CI takes only the patch and prerelease parts from the branch name, so `x.y` must match the props. +- Package version is `..[-]` from `MajorVersion`/`MinorVersion` in the root `Directory.Build.props`. On a `rel/x.y.z[-pre]` branch CI takes only the patch and prerelease parts from the branch name, so `x.y` must match the props. - Release is the real gate: it adds `TreatWarningsAsErrors` and `EnforceCodeStyleInBuild`; Debug does not (nullable warnings are errors in both). Fix the code rather than adding `NoWarn`, `WarningsNotAsErrors` or pragmas, and don't remove the existing exceptions in the Release group. - CI job `Xaml-Style-Check` gates the whole `build` matrix. `./ApplyXamlStyling.ps1` with no flags reads `git status`, which collapses a new untracked folder to one entry, so a brand-new component's XAML is skipped: `git add` it first and use `-Staged`. ## Never - Commit changes to the tracked `tooling/MultiTarget/EnabledMultiTargets.props` that tooling scripts rewrite (the submodule shows as modified in `git status`): `git -C tooling checkout -- MultiTarget/EnabledMultiTargets.props`. -- Edit files under `tooling/` as part of a change here: they are not part of this repo's commits. Change tooling in its own repo, then bump the submodule pointer as a separate commit; before merging, the pointer must be on a commit that is on tooling `main`. CI hard-codes `tooling/CommunityToolkit.Tooling.SampleGen.Tests/bin/Release/net8.0/...`: a bump that moves it needs a matching workflow edit. +- Edit files under `tooling/` as part of a change here: they are not part of this repo's commits. Change tooling in its own repo, then bump the submodule pointer in its own commit; a pointer to an unmerged tooling branch is temporary and must be re-pointed to tooling `main` once that merges. CI hard-codes the `tooling/CommunityToolkit.Tooling.SampleGen.Tests` output path in `build.yml`: a bump that moves it needs a matching workflow edit. - Hand-edit `catalog/toolkit-samples.json` (generated; see `.github/instructions/components.instructions.md`). - Remove or rename `ToolkitConvertersSourceProject`, `ToolkitSettingsControlsSourceProject`, `ToolkitExtensionsSourceProject` or `ToolkitTriggersSourceProject`: tooling's sample/test heads silently fall back to a pinned preview NuGet package when they are unset. - Put MultiTarget- or tooling-dependent logic in the root `Directory.Build.targets`: it also applies to `tools/`, which only isolates itself from the root `Directory.Build.props`. diff --git a/.github/instructions/components.instructions.md b/.github/instructions/components.instructions.md index 95f5b46f..0de2cb28 100644 --- a/.github/instructions/components.instructions.md +++ b/.github/instructions/components.instructions.md @@ -4,17 +4,18 @@ applyTo: "components/**,catalog/**,tools/**" # Components, sample index and `tools/` ## Components -- Reference sibling components with `$(ToolkitSourceProject)` from the root `Directory.Build.props` (add the property there if it is missing), not relative paths. -- Component projects reference siblings unconditionally, so a component's `` list must be a subset of every referenced component's `src/MultiTarget.props` (e.g. a component that builds for Uno cannot depend on a `uwp;wasdk`-only one). -- Converters, SettingsControls, Extensions and Triggers are compiled into every sample app head (Extensions also into every test head): a break in one of them breaks every head, not just its own component. -- The sample index takes `nugetPackage` from the `src` csproj *file name*, while the real package id comes from `PackageId`. A package whose id contains `.Controls.` (controls: `$(PackageIdPrefix).$(PackageIdVariant).Controls.$(ToolkitComponentName)`) must set `PackageId` explicitly and keep the csproj file name equal to it; the tooling default has no `.Controls`. +- Prefer `$(ToolkitSourceProject)` from the root `Directory.Build.props` over relative paths for sibling component references (add the property there if it is missing). +- Component projects reference siblings unconditionally, so a referenced component must be buildable on every MultiTarget the referencing one builds for (e.g. a component that builds for Uno cannot depend on a `uwp;wasdk`-only one). +- Converters, SettingsControls, Extensions and Triggers are project-referenced by every sample app head (Extensions also by every test head), and `tooling/` code consumes their public API: a break or API change in one of them breaks every head, and the tooling side cannot be fixed from here. +- The sample index takes `nugetPackage` from the `src` csproj *file name*, which is the WinUI-variant package id (`CommunityToolkit.WinUI...`; the UWP variant swaps the variant segment). The tooling default `PackageId` has no `.Controls`, so a control must set `PackageId` to `$(PackageIdPrefix).$(PackageIdVariant).Controls.$(ToolkitComponentName)` and name its csproj to match; the `ctk-component` template does not do this. Set it *after* the `ToolkitComponent.SourceProject.props` import, which is what defines `PackageIdVariant`. ## Sample index (`catalog/toolkit-samples.json`) `catalog/README.md` describes the file and the `generate`/`check` commands. Easy to miss: -- It is derived from `components/*/samples/**/*.md` (only files with front matter), `*.xaml.cs` (`[ToolkitSample]`), the single csproj in each `src/` and the type/namespace declarations in `components/*/src/**/*.cs` (they narrow `usings`). A pure `src` change can therefore make the index stale. Run `check` after touching any of these and commit the regenerated file with the change. +- It is derived from `components/*/samples/**/*.md` (only files with front matter), `*.xaml.cs` (`[ToolkitSample]`) and the paired `.xaml`, the single csproj in each `src/` and the type/namespace/extension-method declarations in `components/*/src/**/*.cs` (they narrow `usings`). A pure `src` change can therefore make the index stale. After touching any of these run `generate` and commit the result with the change. +- Run `check` and the tests on a tree without sample build output: building a sample project copies its `*.md`/`*.xaml.cs` into `components/*/samples/bin`, which the exporter does not exclude, so both then fail with "sample id ... is already declared". Delete that output first (see the validation skill's clean-up). +- `dotnet test tools/SampleIndexExporter.Tests` (also run by CI) is stricter than `check`: it also fails on unreferenced `[ToolkitSample]`s, withheld samples and sample-less docs missing from its allow-list (`CoverageTests`). - An entry id is the slug of the *markdown file name*, must be unique across all components (a collision is an error) and is published as a stable id: renaming a docs file changes it. -- `generate`/`check` report warnings without failing; only errors exit non-zero. - The exporter and its tests target a runtime older than the SDK in `global.json`. If it is not installed, set `$env:DOTNET_ROLL_FORWARD='Major'` (persists for the session) before `dotnet run`/`dotnet test`. ## `tools/` -- Platform-agnostic projects that read the repo as text. `tools/Directory.Build.props` is deliberately empty to stop inheriting the root props, and the CI job does not check out `tooling/` or install workloads: they must not reference `tooling/` or WinUI/Uno. +- The CI job for `tools/` does not check out `tooling/` or install workloads, so these projects must not reference `tooling/` or WinUI/Uno. diff --git a/.github/skills/validate-component-changes/SKILL.md b/.github/skills/validate-component-changes/SKILL.md index 5717c92a..a3e862a9 100644 --- a/.github/skills/validate-component-changes/SKILL.md +++ b/.github/skills/validate-component-changes/SKILL.md @@ -8,40 +8,41 @@ description: Build and test changes to components, sample docs/XAML, root props Mirrors `.github/workflows/build.yml`; run from the repo root on Windows. Read `tooling/.github/instructions/powershell-scripts.instructions.md` first: the scripts have side effects and report failures with exit code 0, so read their output. ## Prerequisites -- `msbuild.exe` from Visual Studio on `PATH` (Developer shell, or prepend `\MSBuild\Current\Bin\amd64`); otherwise `GenerateSingleSolution.ps1` waits for a keypress. `vstest.console.exe` is in `\Common7\IDE\CommonExtensions\Microsoft\TestWindow` and is on `PATH` only in a Developer shell. -- `dotnet tool restore` once. Workloads and Windows SDK per `ReadMe.md`; the Uno `macos`/`ios`/`android` legs also need the workloads CI installs with `uno-check`. -- If nuget.org is unreachable, patch the feed in `nuget.config` temporarily and never commit it. +- `msbuild.exe` from Visual Studio on `PATH` (Developer shell, or prepend `\MSBuild\Current\Bin\amd64`); otherwise `GenerateSingleSolution.ps1` waits for a keypress. `vstest.console.exe` lives in `\Common7\IDE\CommonExtensions\Microsoft\TestWindow`. +- `dotnet tool restore` once. Build requirements are in `tooling/ReadMe.md` (the root `ReadMe.md` is out of date); CI runs `uno-check` for every leg except `wasdk`, `wpf` and `linuxgtk`. +- If nuget.org is unreachable, restore fails; revert any local feed override in `nuget.config` before committing. ## 1. Fast loop: one component ```powershell ./tooling/ProjectHeads/GenerateSingleSampleHeads.ps1 -MultiTargets wasdk -winui 3 -componentPath $PWD\components\ -Launch $false -IncludeReferencedProjects msbuild.exe components\\.slnx /restore /nowarn:MSB4011 -p:Configuration=Release /m ``` -Use `-MultiTargets uwp -winui 2` for WinUI 2. Confirm `Generated solution` in the output before building. Without `-IncludeReferencedProjects`, sibling components (Extensions, Triggers, ...) are not in the `.slnx` and get built as **Debug**, so the Release warning gate does not apply to them. +Use `-MultiTargets uwp -winui 2` for WinUI 2. Before building, check the output for `Generated solution` and that the `.slnx` lists the expected projects (the message is printed even if a reference failed to resolve). Without `-IncludeReferencedProjects`, sibling components (Extensions, Triggers, ...) are not in the `.slnx` and get built as **Debug**, so the Release warning gate does not apply to them. Tests, as CI runs them (`Tests.Uwp` for WinUI 2): ```powershell -vstest.console.exe (Get-ChildItem components\\heads\Tests.Wasdk -Recurse -Filter *.appxrecipe).FullName /Framework:FrameworkUap10 +vstest.console.exe (Get-ChildItem components\\heads\Tests.Wasdk -Recurse -Filter *.build.appxrecipe | Where-Object FullName -Match '\\Release\\' | Select-Object -First 1).FullName /Framework:FrameworkUap10 ``` The WinAppSdk test host needs the .NET runtime matching the head's TFM; if it is missing, report the tests as not run. ## 2. Release gate on source projects ```powershell +New-Item -ItemType Directory $env:TEMP\nupkgs -Force | Out-Null ./tooling/Build-Toolkit-Components.ps1 -Components -MultiTargets wasdk -WinUIMajorVersion 3 -Release -NupkgOutput $env:TEMP\nupkgs ``` -Builds each `src` project (and its dependencies) directly in Release; packs only because `-NupkgOutput` is given. A component that does not support the MultiTarget is skipped with a warning and exit code 0. CI's package job uses `-MultiTargets all` per WinUI version. +Builds each `src` project (and its dependencies) directly in Release; packs only because `-NupkgOutput` is given, and that folder must already exist. A component that does not support the MultiTarget is skipped with a warning and exit code 0. CI's package job uses `-MultiTargets all` per WinUI version. ## 3. CI build legs (all components) One leg per `build.yml` matrix entry (`uwp` with WinUI 2; the rest with WinUI 3): ```powershell -powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -MultiTargets wasdk -WinUIMajorVersion 3 -Launch 0" +./tooling/GenerateAllSolution.ps1 -MultiTargets wasdk -WinUIMajorVersion 3 -Launch $false msbuild.exe /restore /nowarn:MSB4011 /p:Configuration=Release /m CommunityToolkit.AllComponents.slnx ``` -A cold `wasdk` leg takes a few minutes. After single-component builds, run `git clean -fdX components` first: leftover `samples/bin` output makes the all-components test head fail with `APPX1101` (duplicate `*.xaml` payload). The all-components `uwp` leg finds no component tests (see tooling's multitarget instructions); UWP component tests only run from a single-component solution (step 1). +A cold `wasdk` leg takes a few minutes. `wasdk` then runs the component tests like CI: `vstest.console.exe ./tooling/**/CommunityToolkit.Tests.wasdk.build.appxrecipe /Framework:FrameworkUap10`. `uwp` and `wasdk` share TFMs and output folders, so clean (step 5) when switching legs or after single-component builds: stale `samples/bin` output made the all-components test head fail with `APPX1101` (duplicate `*.xaml` payload). The all-components `uwp` leg finds no component tests (see tooling's multitarget instructions); UWP component tests only run from a single-component solution (step 1). ## 4. Other CI jobs - XAML style: `./ApplyXamlStyling.ps1 -Passive` checks every file; to fix your changes, `git add` them and run `./ApplyXamlStyling.ps1 -Staged`. -- Sample index: `dotnet run --project tools/SampleIndexExporter -- check` and `dotnet test tools/SampleIndexExporter.Tests` (runtime note in `.github/instructions/components.instructions.md`). +- Sample index: `dotnet run --project tools/SampleIndexExporter -- check` and `dotnet test tools/SampleIndexExporter.Tests`, **before building samples or after step 5** (sample build output breaks them; details and the runtime note are in `.github/instructions/components.instructions.md`). ## 5. Clean up -Run `dotnet build-server shutdown` first: lingering MSBuild nodes lock `bin`/`obj` and make `git clean` fail partway. Then `git clean -fdX components` (ignored build output, `heads/`, `*.slnx`), delete the root `CommunityToolkit.AllComponents.slnx`, `git -C tooling clean -fdX`, `git -C tooling checkout -- MultiTarget/EnabledMultiTargets.props`, and revert any `nuget.config` patch. `git status` and `git -C tooling status` must show only your intended changes. +Run `dotnet build-server shutdown` first: lingering MSBuild nodes lock `bin`/`obj` and make `git clean` fail partway. Preview with `git clean -ndX components` (ignored files include more than build output, e.g. `.vs/`, `*.user`), then `git clean -fdX components` (build output, `heads/`, `*.slnx`); delete the root `CommunityToolkit.AllComponents.slnx`; do the same in `tooling/` with `git -C tooling clean -fdX`; `git -C tooling checkout -- MultiTarget/EnabledMultiTargets.props`. `git status` and `git -C tooling status` must show only your intended changes.