WiX MSI installer add optional true/false flag passthrough to Electron app

George Li 1 Reputation point
2021-08-23T17:50:42.563+00:00

Currently I am building an Electron project to a MSI installer using electron-builder, which comes with a WiX template.xml that it uses to generate the MSI installer.

Is there a way to configure/edit the installer so my Electron app can know what optional parameters, specifically parameters set with Msiexec.exe, it was installed with?
Essentially I need the Electron app to know what options it was installed with, preferably without installing an extra file.

I've done a little research on this and the only way I found to get this sort of behavior is to optionally install a file that my app would then try to detect, where if the file is present it would mean optionalparam=true and if the file was not present it would mean optionalparam=false. But is there a better way?

e.g.

I install my electron app with Msiexec.exe /i "install.msi" /qn /norestart optionalparam=true

Then the installer should push what install parameters were used (what 'optionalparam' was set to, where unset = false)

or

My installed Electron app should be able to call some API functions to eventually determine what installer parameters were used

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
728 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,438 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 11,506 Reputation points Microsoft Vendor
    2021-08-25T07:33:41.427+00:00

    According to Getting and Setting Properties (Windows Installer), you can get and set property values from programs using MsiGetProperty and MsiSetProperty and include as part of conditional statements in the installation database. Windows Installer Examples attached.

    0 comments No comments