Skip to content

fix(windows): make Windows ARM64 build start and package correctly#1809

Open
aequivalent2 wants to merge 2 commits into
nextcloud:mainfrom
aequivalent2:fix/windows-registry-arch-aware
Open

fix(windows): make Windows ARM64 build start and package correctly#1809
aequivalent2 wants to merge 2 commits into
nextcloud:mainfrom
aequivalent2:fix/windows-registry-arch-aware

Conversation

@aequivalent2

@aequivalent2 aequivalent2 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Two fixes needed for a working win32-arm64 build/release, on top of the packaging groundwork
from #1725:

  1. App crashes immediately on launch on arm64. getWindowsRegistryItem()
    (src/app/windows.utils.ts) threw unconditionally on any non-x64 architecture, before ever
    attempting to load the native @vscode/windows-registry module. Since
    readManagedConfig() (src/app/managedConfig.service.ts) is called at module scope in
    AppConfig.ts, i.e. on every app start, this throw is never caught: Error: getWindowsRegistryItem is only available on x64

  2. MSI installer would be mislabeled as x64 even when packaging arm64.
    MakerWix in forge.config.js hardcoded arch: 'x64'. electron-wix-msi's MSICreator
    does not auto-detect architecture (this.arch = options.arch || 'x86') - it just embeds
    whatever string it's given as the WiX Platform attribute (and derives
    ProgramFiles64Folder vs ProgramFilesFolder from it). The arm64-not-supported comment
    predates electron-wix-msi 5.1.3 (already the resolved version here), which added arm64
    as a valid Platform value via WiX Toolset >=3.14's candle.exe - confirmed working by
    community testing in build: add scripts for Windows ARM64 build #1725.

Changes

  • Resolve the native Registry module path per process.arch instead of a hardcoded
    win32-x64 path; treat a missing prebuild for the current architecture as a recoverable
    error (return undefined) instead of throwing.
  • Use the existing TARGET_ARCH variable (already used for Squirrel installer filenames) for
    MakerWix's arch option instead of a hardcoded 'x64'.

Both changes are no-ops for existing x64 packaging/behavior.

Testing

  • Applied and verified both patches against a fresh clone of main (git am, no conflicts).
  • Verified windows.utils.ts change with esbuild (syntax/bundle check).
  • Verified forge.config.js change with node --check.
  • Verified electron-wix-msi@5.1.3 (resolved via @electron-forge/maker-wix@7.11.1) accepts
    arm64 as options.arch by reading MSICreator's source directly.

Related

Copilot AI review requested due to automatic review settings July 12, 2026 17:18

This comment was marked as low quality.

@nickvergessen nickvergessen added bug Something isn't working os: Windows 🪟 labels Jul 13, 2026
@nickvergessen
nickvergessen requested a review from ShGKme July 13, 2026 11:30

@ShGKme ShGKme 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.

Thank you and sorry we missed the arm64. One day we'll have a Windows arm64 device for testing =D

Instead of ignoring arm64, let's actually add support for it.
I'm preparing a new release of the package with arm64 support.

You can test it locally with:

npm i github:nextcloud-deps/vscode-windows-registry#fix/build-arm64

If you have any errors on install, just ignore scripts:

npm i --ignore-scripts github:nextcloud-deps/vscode-windows-registry#fix/build-arm64 

Comment thread forge.config.js
// electron-wix-msi (>=5.1.3, in use here) supports 'x86' | 'x64' | 'arm64' as Platform
// via WiX Toolset >=3.14's candle.exe. Use the actual packaging target instead of a
// hardcoded 'x64', otherwise win32-arm64 builds ship an MSI mislabeled as x64.
arch: TARGET_ARCH,

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.

The comment isn't entirely true. WiX Toolset >=3.14's candle.exe indeed claims to support arm64.

However, electron-wix-msi@5.1.3 doesn't. It is documented as

Values can be either x86 or x64

https://github.com/electron-userland/electron-wix-msi/blob/v5.1.3/README.md?plain=1#L150-L151

And the source code checks for this property like it is either one or another.

For example: https://github.com/electron-userland/electron-wix-msi/blob/f62348b06b8dd855a13f276782d862f3acc16bd2/src/creator.ts#L410

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.

Probably, we can use arm64 here. But I'm unsure if it is needed. This is only the installer arch, not the installed app, isn't it?

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.

Do you have any problems with x64 installer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

electron-userland/electron-wix-msi#150

This issue states that, while not officially supported, it does work.

Comment thread src/app/windows.utils.ts
Comment thread src/app/windows.utils.ts Outdated
Comment thread src/app/windows.utils.ts
@ShGKme

ShGKme commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Asking just in case. If this PR is AI Assisted, please, add Assisted-by: AGENT_NAME:MODEL_VERSION to the commit description.

Details: https://github.com/nextcloud/server/blob/master/.github/CONTRIBUTING.md#ai-assisted-contributions

…of hardcoded x64 Assisted-by: Claude:claude-sonnet-5

Signed-off-by: Leonhard Ruckert <leonhard.ruckert@outlook.com>
… hardcoded x64 Assisted-by: Claude:claude-sonnet-5

Signed-off-by: Leonhard Ruckert <leonhard.ruckert@outlook.com>
@aequivalent2
aequivalent2 force-pushed the fix/windows-registry-arch-aware branch from 3a4b876 to 927bb6a Compare July 13, 2026 21:08
@ShGKme ShGKme added the AI assisted This PR contains AI-assisted commits label Jul 14, 2026
@aequivalent2

Copy link
Copy Markdown
Contributor Author

Ive added a few things

@aequivalent2

aequivalent2 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Is there anything what has to be done now?

This comment was marked as low quality.

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

Labels

AI assisted This PR contains AI-assisted commits bug Something isn't working os: Windows 🪟

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants