Skip to content

Refactor build.cmd for ARM64 and add build.cmd.ps1#14702

Open
KlausLoeffelmann wants to merge 73 commits into
dotnet:mainfrom
KlausLoeffelmann:repairBuildArm64Locally
Open

Refactor build.cmd for ARM64 and add build.cmd.ps1#14702
KlausLoeffelmann wants to merge 73 commits into
dotnet:mainfrom
KlausLoeffelmann:repairBuildArm64Locally

Conversation

@KlausLoeffelmann

@KlausLoeffelmann KlausLoeffelmann commented Jul 5, 2026

Copy link
Copy Markdown
Member

Fixes #12207.

  • Refactored build.cmd to delegate to a new PowerShell script (build.cmd.ps1) for improved argument parsing and platform detection.

  • Added support for building on Windows ARM64 via the -platform arm64 option, which sets TargetArchitecture and disables NativeToolsOnMachine.

  • Updated documentation to reflect the new ARM64 build instructions.

Microsoft Reviewers: Open in CodeFlow

@KlausLoeffelmann

KlausLoeffelmann commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@Olina-Zhang, @LeafShi1, @Shyam-Gupta:
I needed to test the new planned APIs for .NET 11 on a locally compiled ARM build, but could not make it work out of the box.

build -configuration release -platform ARM64 did not work.

This introduces a different batch file, which is picked up when you build locally on ARM (tested on a Surface X, work fine).

If there is a better way to do this, please advise and then feel free to close the PR. Thanks!

@KlausLoeffelmann
KlausLoeffelmann requested review from Copilot and removed request for a team July 5, 2026 17:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the repository’s root build.cmd entrypoint to delegate to a new eng/build.cmd.ps1 wrapper, aiming to improve argument handling and add guidance for building on Windows ARM64.

Changes:

  • Added eng/build.cmd.ps1 to preprocess arguments (notably ARM64) before invoking eng/common/build.ps1.
  • Updated build.cmd to call the new PowerShell wrapper instead of calling eng/common/build.ps1 directly.
  • Updated docs/building.md with Windows ARM64 build instructions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
eng/build.cmd.ps1 New wrapper script for build argument parsing and ARM64 detection before invoking eng/common/build.ps1.
build.cmd Delegates to eng/build.cmd.ps1.
docs/building.md Documents ARM64 build invocation via -platform arm64.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread eng/build.cmd.ps1
Comment thread eng/build.cmd.ps1 Outdated
Comment thread docs/building.md
@LeafShi1

LeafShi1 commented Jul 6, 2026

Copy link
Copy Markdown
Member

@Olina-Zhang, @LeafShi1, @Shyam-Gupta: I needed to test the new planned APIs for .NET 11 on a locally compiled ARM build, but could not make it work out of the box.

I did a quick comparison between the current code and this PR.

On my x64 machine, build -configuration release -platform ARM64 already succeeds and Platform=ARM64 appears in the generated binlog.

With this change, I additionally see TargetArchitecture=arm64 being propagated.

Was the issue primarily reproducible on native ARM64 devices (e.g. Surface X), or was the main problem that TargetArchitecture was not being set correctly for ARM builds?

@Olina-Zhang

Olina-Zhang commented Jul 7, 2026

Copy link
Copy Markdown
Member

@KlausLoeffelmann we have a known issue: #12207 when using build.cmd for main branch of Winforms repo on arm64 VM.

I tested build -configuration release -platform ARM64 for your this branch on arm64 VM, also failed as following:
image

KlausLoeffelmann and others added 20 commits July 8, 2026 22:39
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hand-author the IUISettings3 / UIColor / UIColorType WinRT ABI types and generate the RoActivateInstance / WindowsCreateString / WindowsDeleteString / IInspectable / HSTRING Win32 bindings via CsWin32. The WinRT ABI types are excluded from the .NET Framework build, which does not consume them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Expose the user's current Windows accent color by activating the Windows.UI.ViewManagement.UISettings runtime component and reading UIColorType.Accent. When no accent color is set, Windows returns an OS-defined default, so the method always yields a usable color.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Implements suspend painting and relocation scopes, deferred child positioning, and form appearance mode infrastructure for .NET 11.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rface

Splits DeferLocationChange out of this branch entirely (postponed pending an
anchor-layout-engine integration fix; tracked separately in
#12) and reworks ISupportSuspendPainting /
ISupportSuspendRelocation on Control to match the final API shape agreed in
dotnet#14585:

- Control implements ISupportSuspendPainting/ISupportSuspendRelocation via
  explicit interface implementation instead of public virtual methods, so the
  manual Begin/End pair does not become the primary IntelliSense surface on
  every Control-derived type. Protected virtual BeginSuspendPaintingCore() /
  EndSuspendPaintingCore() / BeginSuspendRelocationCore() /
  EndSuspendRelocationCore() are the new override points.
- ListView, ListBox, ComboBox, TreeView, RichTextBox override the ...Core()
  hooks instead of the old public virtual methods, still routing through
  their existing BeginUpdate/EndUpdate.
- SuspendPaintingScope and SuspendRelocationScope change from
  readonly ref struct to sealed class : IDisposable, so the scope can span an
  await in an asynchronous UI event handler (a ref struct cannot be hoisted
  into an async state machine - this was the flagship usage scenario in the
  original API proposal, and it did not compile against the ref struct
  version). Dispose is idempotent.
- Deletes DeferLocationChangeScope.cs and the Control.DeferLocationChange
  overloads entirely.
- Updates/removes tests accordingly; updates PublicAPI.Unshipped.txt.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…inel

Matches the final API shape agreed in dotnet#14585:

- FormAppearanceMode -> FormRevealMode, adding Inherit = -1 as the ambient
  sentinel (Classic stays the CLR default value 0, matching the
  RightToLeft.Inherit / VisualStylesMode.Inherit precedent for ambient
  enums - the sentinel is a distinct value, not the zero value, so
  default(FormRevealMode) stays conservative).
- Form.FormRevealMode is now a real public virtual, PropertyStore-backed,
  [AmbientValue(Inherit)] property (previously there was no per-Form
  property at all - only the flat, process-wide
  Application.FormAppearanceMode existed). This lets a form such as a splash
  screen opt itself out of deferred reveal without touching the process-wide
  default. Resolution is flat (Form only, no Control-parent-chain): DWM
  cloaking only ever applies to top-level, non-MDI-child windows, so there is
  no hierarchy to walk, unlike VisualStylesMode's genuine control-nesting
  cascade.
- Application.FormAppearanceMode / SetFormAppearanceMode are replaced by
  three members: DefaultFormRevealMode (get; may return the unresolved
  Inherit sentinel, mirroring ColorMode returning the unresolved System
  value), SetDefaultFormRevealMode (freely reassignable, unlike the
  write-once SetDefaultVisualStylesMode - the effective default is derived in
  part from ColorMode/IsDarkModeEnabled, which are themselves mutable for the
  life of the process), and IsFormRevealDeferred (bool; the fully resolved
  answer: Deferred, or Inherit + IsDarkModeEnabled). This also fixes a
  compatibility problem in the original design: the old default was
  unconditionally Deferred whenever SetFormAppearanceMode was never called,
  an opt-out behavior change for every existing app; tying the Inherit
  resolution to dark mode means an app that never touches SystemColorMode
  sees no behavior change, while the scenario the feature exists for
  (dark-mode startup flash) is fixed by default.
- ShouldUseDeferredAppearanceCloak now reads the resolved Form.FormRevealMode
  instead of the old flat Application-only check, so a per-Form override is
  actually honored.
- Adds SR.resx/xlf entries for the new property's designer description.
- Updates/adds tests; updates PublicAPI.Unshipped.txt.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds Microsoft.VisualBasic.ApplicationServices.ApplyApplicationDefaultsEventArgs.FormRevealMode,
following the exact same pattern already established for ColorMode and
HighDpiMode in that class, per dotnet#14585's API Proposal.

WindowsFormsApplicationBase now carries a _formRevealMode shadow field
(defaulting to FormRevealMode.Classic, matching the existing conservative
default for _colorMode) and a protected FormRevealMode property, feeds it
into the ApplyApplicationDefaultsEventArgs constructor alongside
MinimumSplashScreenDisplayTime/HighDpiMode/ColorMode, reads back whatever the
ApplyApplicationDefaults event handler set, and calls
Application.SetDefaultFormRevealMode(_formRevealMode) at the end of
OnInitialize alongside the existing Application.SetColorMode(_colorMode)
call.

This completes work anticipated but never finished in an earlier .NET 9
Visual Styles attempt at this same VB Application Framework extension point
(OnInitialize already carried a comment claiming "We feed the defaults for
HighDpiMode, ColorMode, VisualStylesMode to the EventArgs", but only
HighDpiMode/ColorMode were ever actually wired up).

Updates PublicAPI.Unshipped.txt for Microsoft.VisualBasic.Forms.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ng, and test cancellation/nullable guidance

- building-code: add a top-level TENET to build the solution only with build.cmd (CI parity for
  PublicAPI/analyzer enforcement and -warnAsError); a plain dotnet build is inner-loop only.
- new-control-api: new public/protected overrides must be tracked in PublicAPI.Unshipped.txt with the
  override prefix; note CS0114 (new keyword) and CS1574 (no cref to cross-assembly internal types).
- control-api-tests: async tests must pass CancellationToken (TestContext.Current.CancellationToken,
  CA2016/xUnit1051) and respect the #nullable context (CS8632).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ng, and test cancellation/nullable guidance

- building-code: add a top-level TENET to build the solution only with build.cmd (CI parity for
  PublicAPI/analyzer enforcement and -warnAsError); a plain dotnet build is inner-loop only.
- new-control-api: new public/protected overrides must be tracked in PublicAPI.Unshipped.txt with the
  override prefix; note CS0114 (new keyword) and CS1574 (no cref to cross-assembly internal types).
- control-api-tests: async tests must pass CancellationToken (TestContext.Current.CancellationToken,
  CA2016/xUnit1051) and respect the #nullable context (CS8632).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…n Button and CheckBox toggle renderers

Introduces the (non-experimental) Visual Styles versioning API and the first modern renderers gated behind it:
- VisualStylesMode enum (Classic/Disabled/Net11/Latest); ambient Control.VisualStylesMode (+event/On-methods);
  Application.DefaultVisualStylesMode/SetDefaultVisualStylesMode; Appearance.ToggleSwitch; VB framework APIs.
- HighPrecisionTimer (internal, Primitives) as the animation frame trigger, with tests.
- AnimationManager/AnimatedControlRenderer driven by HighPrecisionTimer.
- Conservative dark-mode Standard button (owner-drawn, reachable) + modern WinUI-style Button renderer.
- CheckBox Appearance.ToggleSwitch modern toggle switch (animated, flicker-free).
- WinformsControlsTest VisualStylesButtons exploratory harness; unit tests.

Verified CI-clean with build.cmd: System.Windows.Forms, Microsoft.VisualBasic.Forms and Primitives build
with no analyzer/PublicAPI/style errors (the only remaining failure is the pre-existing BuildAssist/AxHosts
step, which is an environment limitation unrelated to these changes).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
KlausLoeffelmann and others added 29 commits July 10, 2026 18:29
* Refactor KioskModeManager component and introduce WakeUp-Events incl.. new WakeUpEventArgs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 20883488-cf1e-4ad3-a681-0724e9f16777
Reconcile the recovered button and glyph renderer work with the newer Popup and High Contrast implementations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8c96a2a1-9a56-4ebe-a0d4-08297832eb45
Tint only the clipped offscreen parent-background fill so client-area leakage during BufferedGraphics.Render is immediately visible.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8c96a2a1-9a56-4ebe-a0d4-08297832eb45
VisualStyles state defaults use Application.GetWindowsAccentColor(), so branch 05 now explicitly depends on branch 01.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Fix non-client TextBox painting, modern button state rendering, shared Popup behavior, and font-scaled CheckBox/RadioButton toggle switches.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Keep the branch 01 and branch 05 API declarations as a unique union after applying the integration-tested VisualStyles patch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Integrate the application text-size and Windows accent-color APIs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Integrate configurable TreeView node-leading behavior and its tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Integrate painting and relocation suspension APIs and control rendering improvements.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Integrate kiosk and full-screen management APIs with their lifecycle tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Integrate VisualStylesMode, modern control rendering, and the latest rendering follow-ups.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200

# Conflicts:
#	src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/ApplyApplicationDefaultsEventArgs.vb
#	src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb
Remove duplicate nullable and Form system-text entries introduced while merging independent API branches.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Paint rounded cutouts from the real parent surface, refresh live visual-style changes, correct TextBox and UpDown geometry, normalize rounded paths, and improve Popup sizing and motion.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
* Add a bit of formatting/refactoring while reviewing.
Paint parent content beneath antialiased chrome, reduce TextBox and UpDown sizing, and cover native border suppression.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 225d4d4c-7dd7-46f1-9406-b30ff07bd8b5
Implements suspend painting and relocation scopes, deferred child positioning, and form appearance mode infrastructure for .NET 11.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* WakeUp-Events incl.. new WakeUpEventArgs.
…ng, and test cancellation/nullable guidance

- building-code: add a top-level TENET to build the solution only with build.cmd (CI parity for
  PublicAPI/analyzer enforcement and -warnAsError); a plain dotnet build is inner-loop only.
- new-control-api: new public/protected overrides must be tracked in PublicAPI.Unshipped.txt with the
  override prefix; note CS0114 (new keyword) and CS1574 (no cref to cross-assembly internal types).
- control-api-tests: async tests must pass CancellationToken (TestContext.Current.CancellationToken,
  CA2016/xUnit1051) and respect the #nullable context (CS8632).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…n Button and CheckBox toggle renderers

Introduces the (non-experimental) Visual Styles versioning API and the first modern renderers gated behind it:
- VisualStylesMode enum (Classic/Disabled/Net11/Latest); ambient Control.VisualStylesMode (+event/On-methods);
  Application.DefaultVisualStylesMode/SetDefaultVisualStylesMode; Appearance.ToggleSwitch; VB framework APIs.
- HighPrecisionTimer (internal, Primitives) as the animation frame trigger, with tests.
- AnimationManager/AnimatedControlRenderer driven by HighPrecisionTimer.
- Conservative dark-mode Standard button (owner-drawn, reachable) + modern WinUI-style Button renderer.
- CheckBox Appearance.ToggleSwitch modern toggle switch (animated, flicker-free).
- WinformsControlsTest VisualStylesButtons exploratory harness; unit tests.

Verified CI-clean with build.cmd: System.Windows.Forms, Microsoft.VisualBasic.Forms and Primitives build
with no analyzer/PublicAPI/style errors (the only remaining failure is the pre-existing BuildAssist/AxHosts
step, which is an environment limitation unrelated to these changes).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Refactored build.cmd to delegate to a new PowerShell script (build.cmd.ps1) for improved argument parsing and platform detection.

* Added support for building on Windows ARM64 via the -platform arm64 option, which sets TargetArchitecture and disables NativeToolsOnMachine.

* Updated documentation to reflect the new ARM64 build instructions.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@KlausLoeffelmann
KlausLoeffelmann force-pushed the repairBuildArm64Locally branch from f156625 to 29e127b Compare July 13, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build doesn't work on Windows Arm64

5 participants