question

GeorgeLi-1148 avatar image
0 Votes"
GeorgeLi-1148 asked XiaopoYang-MSFT edited

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

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-apiwindows-app-sdk
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

XiaopoYang-MSFT avatar image
0 Votes"
XiaopoYang-MSFT answered XiaopoYang-MSFT edited

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.