Skip to content

Electron-Builder Incorrectly Uses Host RID for Build #1097

Closed

Description

@AeonSake

I'm unsure what exactly caused this bug, but the recent 0.5.2 update has broken my current cross-platform build pipeline. It seems like the electron-builder is now always building binaries for the RID of the host system, rather than the RID provided via the CLI args or publish profile. This issue occurs on all platforms; I tested the following scenarios:

  • Targeting win-arm64 while on win-x64
  • Targeting osx-x64 while on osx-arm64
  • Targeting linux-x64 while on linux-arm64

Configuration:

  • Package Version: 0.5.2
  • Electron Version: 42.4.1
  • Electron Builder Version: 26.8.1
  • Framework: net10.0
  • Target: any

Steps to Reproduce:

  1. Install the latest package version (0.5.2)
  2. Specify an RID with an architecture different from the host system (e.g., win-arm64 on a win-x64 system) via a publish profile (RuntimeIdentifier)
  3. Build the project using the same RID (e.g., dotnet publish MyProject.csproj -c Release -r win-arm64 -p:PublishProfile=win-arm64)
  4. Investigate/test the build artifacts; the electron-builder output will also have the incorrect name (e.g., linux-arm64-unpacked on a linux-arm64 system when targeting linux-x64 for which the folder should be called linux-unpacked by default)

Activity

  1. changed the title [-]Electron Incorrectly Uses Host RID for Build[/-] [+]Electron-Builder Incorrectly Uses Host RID for Build[/+] on Aug 9, 2026
  2. epsnm commented on Aug 10, 2026

    @epsnm
    Contributor

    @AeonSake Adding the architecture to the path occurs when the arch does not match with the default platform architecture.
    This is the default behavior of electron-builder (see https://github.com/electron-userland/electron-builder/blob/075efcf2725a733aa25bb115801dee62e85a5594/packages/app-builder-lib/src/platformPackager.ts#L260).

    If you change the default arch in electron-builder.json per platform.

    If we want to replicate the previous behavior (always match the targeted arch, we can add -c.$(ElectronPlatform).defaultArch=$(ElectronArch) to enforce the default arch being the dotnet arch)

    There is another issue here: as we let the electron builder choose the architecture, the cross-compiler chooses the wrong one. You can see it using --tl:off while building.

    @FlorianRappl can you assign it to me ?

  3. epsnm commented on Aug 10, 2026

    @epsnm
    Contributor
  4. added this to the 0.6.0 milestone on Aug 10, 2026
  5. added a commit that references this issue on Aug 10, 2026
  6. AeonSake commented on Aug 10, 2026

    @AeonSake
    ContributorAuthor

    @AeonSake Adding the architecture to the path occurs when the arch does not match with the default platform architecture.
    This is the default behavior of electron-builder (see https://github.com/electron-userland/electron-builder/blob/075efcf2725a733aa25bb115801dee62e85a5594/packages/app-builder-lib/src/platformPackager.ts#L260).

    I'm not talking about the fallback/default architecture. When an RID is explicitly set via dotnet CLI args, that RID should really be propagated to electron-builder as it did before. I'd expect the default architecture when, and only when, the RID arg is missing. That would be the behavior I'd expect and that's also how dotnet itself does it. There's also an arg for the architecture itself which should ideally also be supported. -a|--arch sets the given architecture and defaults to the host for the platform (basically building an RID from the architecture and host platform). Similarly, there's --os for the platform only.

  7. AeonSake commented on Aug 10, 2026

    @AeonSake
    ContributorAuthor

    It's probably worth mentioning that what I do in my cross-compile pipeline is the documented and recommended approach, based on the Wiki for Package Building and #943 (comment). I'm not sure why the RID argument is still required even though it's specified in the publish profile, but it also never worked without it in builds that involve multiple project dependencies. Regardless, that RID really should be the main identifier for electron-builder because why would you build a .NET binary for a different architecture than the electron shell.

  8. added a commit that references this issue on Sep 3, 2026
    da0e1f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions