Skip to content

How to pass an install directory from a WiX Burn bootstrapper into an MSI generated by electron-builder? #9441

@RampantDespair

Description

@RampantDespair

Hi, I'm using electron-builder to generate an MSI installer for my app, and I need to support the following scenario:

I have a WiX bootstrapper (Burn) that lets the user choose an install directory. That directory is stored in a WiX variable (e.g. InstallFolder), and I want to pass that value down to the MSI generated by electron-builder, so that the MSI installs into that path.

I do not need the MSI itself to provide any UI or directory selection. All UI and choice happen in the WiX bundle. I just need the MSI to respect the directory passed from the bundle.

I cannot find any documentation on how to make the MSI produced by electron-builder honor MSI properties such as INSTALLDIR or TARGETDIR when invoked by a bootstrapper.


Current electron-builder configuration

{
  "build": {
    "appId": "test.client",
    "artifactName": "test-client-${version}.msi",
    "directories": {
      "output": "release"
    },
    "files": [
      "out/**/*"
    ],
    "productName": "Test Client",
    "win": {
      "target": "msi"
    }
  }
}

There is no documented option such as:

  • installDirectory
  • defaultInstallDir
  • msiProperties

So I’m not sure how to tell electron-builder which MSI property controls the final install path, or how to make it consume a value passed from an external bootstrapper.


WiX Bundler Context (for reference)

I also have a WiX bootstrapper that wraps the MSI (generated by electron-builder). Here is the minimal relevant portion:

<Bundle
  Name="Test Setup"
  Version="1.0.0.0"
>
  <Variable
    Name="InstallFolder"
    Type="formatted"
    Value="[ProgramFiles64Folder]Test"
    bal:Overridable="yes"
  />

  <BootstrapperApplication>
    <bal:WixStandardBootstrapperApplication
      SuppressOptionsUI="no"
    />
  </BootstrapperApplication>

  <Chain>
    <MsiPackage
      Id="ClientMsi"
      SourceFile="test-client-$(ClientVersion).msi"
      Vital="yes"
    >
      <MsiProperty Name="TARGETDIR" Value="[InstallFolder]\Client" />
    </MsiPackage>

    <!-- other stuff... -->
  </Chain>
</Bundle>

The issue is that the MSI built by electron-builder appears to:

  • Ignore the TARGETDIR property passed from the bundle
  • Install into its own default location instead of [InstallFolder]\Client

Main Question

Is there a supported way in electron-builder’s MSI target to:

  • Make the generated MSI honor directory-related properties passed by a bootstrapper (e.g., TARGETDIR, INSTALLDIR, or a custom property)?
  • Configure which MSI property controls the install directory, so that a WiX Burn bundle can set it via <MsiProperty>?

I haven’t found any examples or documentation on wiring an external WiX variable (like InstallFolder) through to the MSI generated by electron-builder so that the MSI installs into that specific path.

Any clarification or guidance would be greatly appreciated. If this is not currently supported, knowing that would also help so I can adjust my bundling approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions