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) should be written in a file.
Example:
when MsiExec /i "MyProject.msi" SERVER_ENDPOINT=myapp.example.com
then myapp.example.com
should appear in a file in the installation dir.
I tried to edit electron-builder's wix template file adding the following to write ${SERVER_ENDPOINT} to server.txt
File C:...MyProject
ode_moduleselectron-builder-libemplatesmsiemplate.xml
...
<CustomAction Id="writeConfigFile" Directory="APPLICATIONFOLDER" Execute="commit" Impersonate="yes" ExeCommand="cmd.exe /c "echo ${SERVER_ENDPOINT} > server.txt"" Return="check" />
...
<InstallExecuteSequence>
...
<Custom Action="writeConfigFile" After="InstallFinalize"/>
</InstallExecuteSequence>
Running with
MsiExec /i "MyProject.msi" /L*v Install.log SERVER_ENDPOINT=myapp.example.com
I does not work yet. It installs but does not show writeConfigFile
in the log file.
Do you think this is the right approach to make the msi file parameterized?
Or would you recommend another solution?
I also found Orca.exe, to create an MST file, but I would prefer a simple solution, without manual steps.
See Question&Answers more detail:os