I\'m trying to create an .msi installer file with electron-builder (version 20.39.0), that can be parameterized during install time. The parameters (e.g. server endpoint) sh
I am unfamiliar with Electron builder. However, in MSI terms you need to specify that the content in the file should be replaced by an MSI Property, and then you need to set the property either in a transform, by command line or in the property table (embedded in MSI).
In fact you can set all three at once, and I am not sure which one would apply :-). Command line certainly overrides the property table, but I am not sure what wins in a battle between a transform and a command line parameter:
Transform (applying transform on command line, actual settings inside the transform file - mst):
msiexec.exe /i "MySetup.msi" TRANSFORMS="MyTransform.mst"
Command Line (setting PUBLIC properties on the command line):
msiexec.exe /i "MySetup.msi" MYPROPERTY="My Value here"
Property Table (the built-in Property table in every MSI can also have a value set):
Setting properties is obviously not enough, you have to define where the value goes during installation.
INI file it is quite easy to set a parameter, since this is a built-in feature of MSI.XML file updates and text file updates are worse because then you rely on third-party solutions or you do it yourself via custom actions (I would not do the latter).Advanced Installer has very nice features to replace parameters in XML and text files. Installshield also has such features. The open source WiX toolkit also has features to support XML file updates, but it is much more involved than the commercial tools.
With regards to Electron I don't know how it works. But, in either case the central task is to get the MSI to contain a construct such as this:
This is from an MSI compiled with Advanced Installer. You see that I have a parameterized value [MYVALUE]. It can be set on the command line since it is an ALL UPPERCASE property - also known as a PUBLIC MSI property. During installation the property in braces will be replaced by the value passed in. Obviously.
Some Links: