[nsis] use custom install/uninstall keys in windows registry
See original GitHub issue- Version: 21.2.0
- Target: Windows
Currently electron-builder only provides the customisation for windows registry installation and uninstall keys via nsis.guid field. if not provided, the GUID is produced automatically based on the appId field.
However I would like to use a product name instead of GUID. That wasn’t a problem until very recently, I used to have nsis.guid assigned to my product name and that worked fine.
Since #4069 got merged, the uninstall key under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Product Name is now being wrapped in curly braces HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{Product Name}.
So not only this is a breaking change, but it also prevents me from abusing the nsis.guid in such manner. Removing the nsis.guid leaves me with the GUID being used for the installation key, i.e HKLM\SOFTWARE\0000-0000-0000-0000 instead of HKLM\SOFTWARE\Product Name.
Based on documentation, that’s fine for uninstall key, but I couldn’t find the same mention for the HKLM\SOFTWARE so I assume in the sake of backward compatibility Microsoft Windows supports both GUIDs or Product names.
Based on a quick survey conducted by my colleagues on a very boring windows machine, we couldn’t find a single software product using GUID instead of Product name under HKLM\SOFTWARE, besides apps built with electron-builder.
Additionally, there is a discrepancy in how GUID is being used since #4069, only uninstall key is wrapped in curly braces:
HKLM\SOFTWARE\0000-0000-0000-0000
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{0000-0000-0000-0000}
We’ve also noticed that some Antivirus products get triggered when they stumble upon a GUID key created under HKLM\SOFTWARE\{GUID}.
Given all of the reasoning above, it would be amazing to be able to use the productName for the HKLM\SOFTWARE entry name. This is a breaking change so there must be a migration path.
Based on the source code, it already seems that there is some sort of sanitisation going on in nsisTarget.ts, so allowing something like options.registryInstallerKey || options.guid || UUID.v5(...) would do it.
Also maybe moving curly braces from here into the NsisTarget.ts itself would be wiser, this way we could customise the UNINSTALL_APP_KEY without being trapped in curly braces:
for instance:
could be:
const guid = '{' + options.guid || UUID.v5(appInfo.id, ELECTRON_BUILDER_NS_UUID) + '}';
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:16 (6 by maintainers)

Top Related StackOverflow Question
This is still relevant, please re-open!
(stale bot is one of the worst “features” of github issues, imho. An issue won’t magically be solved by just waiting for a bit)
@develar please re-open this issue. There is no activity on this issue because there is not much to add to it besides that someone has to fix it.