electron-userland / electron-wix-msi

:dvd: Create traditional MSI installers for your Electron app
MIT License
319 stars 93 forks source link

Setting additional WIX options #24

Open schontz opened 6 years ago

schontz commented 6 years ago

Is there a way to do more WIX configuration? Specifically, I am trying to set the installer icon. And eventually I want do things like: http://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/configure_arp_appearance.html

MatthieuLeMee commented 4 years ago

Electron wix msi generates a WIX template before compiling it with WIX toolset.

I've been able to override the template generated by new MSICreator() and store it as a file.

Initial wix .wxs template can be read from the output msiCreator.wixTemplate initially. Then you can update it with new placeholders {{WhatYouWant}} and dynamically set values.

// custom wix template to add another shortcut for readonly mode
msiCreator.wixTemplate = fs.readFileSync(path.join(__dirname, wixTemplatePath), 'utf8');
msiCreator.wixTemplate = msiCreator.wixTemplate.replace(/{{DefaultIcon}}/gi, path.join(__dirname, staticResourcesDir, 'myicon.ico'));
rmirabelle commented 2 years ago

Apparently, there's already an option to update the WiX template built into the MSICreator class:

const creator = new MSICreator({})
//replace is built-in
creator.wixTemplate.replace('find expression', 'replace expression')

That being said, it's still unclear how this actually works. I'm assuming that electron-wix-msi loads the wix.xml template file from (/node_modules/electron-wix-msi/static/wix.xml) into memory, does the replace, then uses the result as the WiX template.