Skip to content

Fix Avalonia.DesignerSupport build on win-arm64#20994

Open
drasticactions wants to merge 2 commits intomasterfrom
dev/timill/win-arm64-build
Open

Fix Avalonia.DesignerSupport build on win-arm64#20994
drasticactions wants to merge 2 commits intomasterfrom
dev/timill/win-arm64-build

Conversation

@drasticactions
Copy link
Copy Markdown
Contributor

@drasticactions drasticactions commented Mar 26, 2026

TL;DR When building on Windows ARM64, there were two problems:

  1. Bun.Unofficial.Tool doesn't support win-arm64, so it would fail to build when trying to pull it in.
  2. The nodejs build.js included @chialab/esbuild-plugin-html, which build in dependencies that wouldn't work on win-arm64.

This PR refactors it so:

  • If you're on win-arm64, you need to install Bun on your system. If you don't have it, it'll throw an error telling you to install it.
  • The build.js and webapp code so it uses an up-to-date esbuild and doesn't require the other plugins, so now it should work on all platforms and not depend on native components.

Checking the gz HTML and JS embedded between 12.0.0-rc1 and the local build on my ARM laptop, as far as I can tell, they look the same and are functionally the same.

Copilot stuff below:

This pull request improves cross-platform compatibility for Bun usage in build scripts, updates the webapp build process, and removes an unnecessary dependency. The changes ensure that the build works seamlessly on platforms where Bun.Unofficial.Tool is unsupported (such as Windows ARM64) by falling back to a system-installed bun binary. Additionally, the webapp build process is modernized and simplified.

Cross-platform Bun detection and usage:

  • Updated all relevant .csproj files and the Nuke build script to attempt using Bun.Unofficial.Tool via dnx first, and fall back to a system-installed bun if not supported. This logic is now centralized and consistent across the build, designer support, and test projects, improving reliability on platforms like win-arm64. [1] [2] [3] [4]

Webapp build process improvements:

  • Changed the webapp build entry point from index.html to index.tsx, and replaced the @chialab/esbuild-plugin-html plugin with a custom inline HTML plugin to generate the final index.html. This simplifies the build process and ensures the output HTML references the correct hashed JS bundle. [1] [2]
  • Updated the esbuild version in package.json to ^0.25.0 and removed the now-unused @chialab/esbuild-plugin-html dependency.

closes #20853

@avaloniaui-bot
Copy link
Copy Markdown

You can test this PR using the following package version. 12.0.999-cibuild0064071-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul MrJul added bug os-windows area-infrastructure Issues related to CI/tooling infrastructur os-browser and removed os-windows labels Mar 26, 2026
</ItemGroup>

<Target Name="BunInstall" Inputs="$(WebAppDir)\package.json" Outputs="$(WebAppDir)\node_modules\.install-stamp">
<Target Name="DetectBun" BeforeTargets="BunInstall">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Extract this target to its own file, and reuse it in the three projects.

}
catch
{
Information("Bun.Unofficial.Tool not supported on this platform, using system-installed bun");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a bit misleading, as Bun can fail for "normal" reasons and this message will be printed instead. Do we have a specific exit code we can detect? Or just special case win-arm64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-infrastructure Issues related to CI/tooling infrastructur bug os-browser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avalonia build fails on Windows arm64

3 participants