Instructions for restoring and building the WinForms repository. Use when asked how to restore NuGet packages, build the full solution, build a single project, create packages, or troubleshoot build errors.
75
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
🛑 TENET — Build the solution ONLY with
build.cmdNever build, validate, or declare the WinForms solution "clean" with a plain
dotnet build/dotnet msbuildofWinforms.sln. Onlybuild.cmd(Arcade) applies the repository's CI configuration — the PublicAPI analyzer (RS0016/RS0017), the code-style and documentation analyzers, and-warnAsError. A plaindotnet buildsilently downgrades or skips these, so "0 warnings" there does NOT mean CI is green — the very same change can fail the official build with errors.
- Full / release / package / "is it clean?" verification → always
build.cmd(see §2).- A single-project
dotnet build(see §3) is an inner-loop convenience only. It is fine while iterating, but you must re-verify withbuild.cmdbefore claiming a change builds cleanly.- If
build.cmdcannot run in your environment, the closest fallback isdotnet build <project> /p:ContinuousIntegrationBuild=true /p:TreatWarningsAsErrors=true— and you must say so explicitly rather than implying abuild.cmdresult.
build.sh
instead of build.cmd / Restore.cmd.WinForms.vsconfig for required workloads.global.json) is used automatically by
build.cmd and Restore.cmd. You do not need a machine-wide SDK install
for command-line builds.Restoring downloads the repo-local SDK and all NuGet packages.
.\Restore.cmdUnder the hood this runs:
eng\common\Build.ps1 -NativeToolsOnMachine -restoreYou can pass any extra Build.ps1 flags after Restore.cmd, e.g.
.\Restore.cmd -configuration Release.
Always use
build.cmd(Arcade) for full, release, and package builds. Do not use a plaindotnet buildof the solution for these — onlybuild.cmdguarantees the Arcade-supported build options and the download of the correct base SDK (global.json) needed to compile. Plaindotnet buildis reserved for the fast single-project inner loop (see Section 3), and even then only after at least one successfulbuild.cmd/Restore.cmd.
.\build.cmdThis restores and builds Winforms.sln in Debug|Any CPU by default.
Under the hood this runs:
eng\common\Build.ps1 -NativeToolsOnMachine -restore -build -blFor a full, clean build of the whole solution, clean the artifacts first, then build:
# 1. Clean the artifacts folder.
.\build -clean
# 2. Build the full solution.
.\buildReporting requirement: a full build is long-running, so while it runs report progress back to
the user in the console to bridge the wait and give early orientation. As assemblies complete,
report which assemblies have been built successfully and which failed and with how many
errors. Prefer running the build with a binary log (the default -bl) and/or stream the console
output so per-project results can be surfaced as they happen rather than only at the end.
.\build -configuration release# Debug packages
.\build -pack
# Release packages
.\build -configuration release -packBuild.ps1 parameter listbuild.cmd forwards every extra argument to eng\common\Build.ps1. The full surface is:
Build.ps1 [-configuration <string>] [-platform <string>] [-projects <string>]
[-verbosity <string>] [-msbuildEngine <string>] [-warnAsError <bool>]
[-warnNotAsError <string>] [-nodeReuse <bool>] [-buildCheck] [-restore]
[-deployDeps] [-build] [-rebuild] [-deploy] [-test] [-integrationTest]
[-performanceTest] [-sign] [-pack] [-publish] [-clean] [-productBuild]
[-fromVMR] [-binaryLog] [-binaryLogName <string>] [-excludeCIBinarylog]
[-ci] [-prepareMachine] [-runtimeSourceFeed <string>]
[-runtimeSourceFeedKey <string>] [-excludePrereleaseVS]
[-nativeToolsOnMachine] [-help] [-properties <string[]>] [<CommonParameters>]| Flag | Short | Description |
|---|---|---|
-configuration <Debug|Release> | -c | Build configuration (default: Debug) |
-platform <x86|x64|Any CPU> | Platform (default: Any CPU) | |
-restore | -r | Restore only |
-build | -b | Build only (skip restore if already done) |
-rebuild | Clean + build | |
-clean | Delete build artifacts | |
-pack | Create NuGet packages (Microsoft.Private.Winforms) | |
-bl / -binaryLog | Emit artifacts\log\Debug\Build.binlog | |
-ci | CI mode (stricter warnings, signing, etc.) | |
-test | -t | Build and run unit tests |
-integrationTest | Build and run integration / functional tests |
# Release build
.\build.cmd -configuration Release
# Build and run unit tests
.\build.cmd -test
# Create NuGet package
.\build.cmd -packInner-loop only. Use plain
dotnet buildof a single project only for quick iteration on one project, and only after at least one successful.\build.cmd/.\Restore.cmd. It does not guarantee the Arcade-supported build options or the download of the correct base SDK, so it must never be used for a full solution build, a release build, packaging, or any build whose result you intend to report as authoritative. For those, always usebuild.cmd(Section 2).
Prefer rebuilding just the project(s) with recent changes by using the
standard dotnet build command, after at least one initial successful
full restore (via .\Restore.cmd or .\build.cmd).
This is much faster than building the whole solution.
# Build a single src project
dotnet build src\System.Windows.Forms\System.Windows.Forms.csproj
# Build a single test project
dotnet build src\test\unit\System.Windows.Forms\System.Windows.Forms.Tests.csproj
# Release configuration
dotnet build src\System.Windows.Forms\System.Windows.Forms.csproj -c ReleaseTip: The repo-local SDK must be on your
PATH. Running.\start-code.cmdor.\start-vs.cmdprepends it automatically. From a plain terminal you can also run.\Restore.cmdfirst (it sets up the SDK).
.\Restore.cmd (one-time, or after SDK/package changes)..\start-vs.cmd — opens Winforms.sln with the repo-local SDK on PATH..\Restore.cmd.\start-code.cmd — opens the workspace with the repo-local SDK on PATH..\build.cmd or dotnet build <project>.| Artifact | Location |
|---|---|
| Binaries | artifacts\bin\<Project>\Debug\<tfm>\ |
| Logs | artifacts\log\ |
| Binary log | artifacts\log\Debug\Build.binlog |
| Test results | artifacts\TestResults\ |
| NuGet packages | artifacts\packages\ |
Use the MSBuild Structured Log Viewer to inspect
.binlog files when troubleshooting build errors.
artifacts\log\Debug\Build.binlog.global.json;
run .\Restore.cmd to ensure the correct SDK is available.4ba3b30
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.