When upgrading from a version of an application built with Electron Builder prior to 21.1.3 to a version built with Electron Builder after 21.1.3, there will be a duplicate "orphaned" uninstall entry in the registry and shown in Apps & Features.
Steps to reproduce:
Expected Result:
The application updates and leaves a single uninstall option
Actual Result:
The application updates but leaves an uninstall record for both versions.
There are two records in the registry under "Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall"
The 21.1.3 version introduced a change (https://github.com/electron-userland/electron-builder/pull/4069/commits/6341b235dbc9aeaf3036a827f4394f3fe8914ee9) which updates the uninstall entries in the Windows registry. Prior to 21.1.3, these entries were simply "GUID". In 21.1.3 and greater, these entries are now "{GUID}". When upgrading from an install prior to 21.1.3, the old "GUID" entry is not removed, but a new "{GUID}" entry is added. This leaves the user with two uninstall records for the application, one for the old version and one for the new version. Uninstalling either of these versions will remove the application, but leave the other version. Attempting to then uninstall the remaining version will result in an error since the application was already uninstalled.
We're also experiencing this issue with our electron builder app:
We're also experiencing this issue with our electron builder app.
Hi @jahraphael! In case it might help you. As a workaround I'm currently having different versions in Mac and Win package.json
21.1.2 for Win project and 21.2.0 for OSX
Seeing the same on our project as well. Can this be cleaned up in a future installer?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm also hoping that this can somehow be cleaned up in a future installer.
We are also affected by the change introduced in #4069. FWIW, you can implement a workaround via custom NSIS script include, e.g. detect an old installation and abort with a message:
!define checkInstOldGUIDFormat "!insertmacro checkInstOldGUIDFormat"
!macro checkInstOldGUIDFormat
; caused by changes in electron-builder in the PR 4069
; see issue https://github.com/electron-userland/electron-builder/issues/4092
; check whether there is a user installation with the old GUID format in registry, abort if found
ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
StrCmp $0 "" 0 askForUninstall
; check whether there is an admin installation with the old GUID format in registry, abort if found
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
StrCmp $0 "" proceed askForUninstall
askForUninstall:
; display info message and abort
MessageBox MB_OK|MB_ICONEXCLAMATION "An existing installation of publiqa was found. Please uninstall it first, then restart the installer.$\r$\n$\r$\nWe are sorry for the inconvenience."
Abort
proceed:
!macroend
!macro customInit
; check whether there is an existing installation with the old GUID in registry
${checkInstOldGUIDFormat}
!macroend
You can also implement a more fancy workaround, e.g. by calling the silent uninstall if available in reg entry:
ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
StrCmp $0 "" proceed 0
ExecWait "$0"
proceed:
or by simply deleting the reg key if your installer handles the old files correctly:
ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
StrCmp $0 "" proceed 0
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}"
proceed:
Hey everyone, how can the old entry be cleaned up if a new version was already installed using the new update? Most of our customers now have bad installation entries.
@hoefling god bless you, sir!
@hoefling @AleksMeshkov can you please share the complete custom include.nsh to have the previous version uninstalled silently without disturbing the user? Please 馃檹馃檹馃檹
I tried the big version (@hoefling) but installer is not affected, dies anyway. To use the nsh I'm doing:
{
"nsis": {
"include": "custom-install.nsh",
....
@damianobarbati Sure. Here you go.
1) In my case there's no need in adding something to the package.json file
2) I just simply created a installer.nsh file in the build directory.
!define checkInstOldGUIDFormat "!insertmacro checkInstOldGUIDFormat"
!macro checkInstOldGUIDFormat
; caused by changes in electron-builder in the PR 4069
; see issue https://github.com/electron-userland/electron-builder/issues/4092
; check whether there is a user installation with the old GUID format in registry, abort if found
ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
StrCmp $0 "" 0 askForUninstall
; check whether there is an admin installation with the old GUID format in registry, abort if found
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
StrCmp $0 "" proceed askForUninstall
askForUninstall:
; display info message and abort
;MessageBox MB_OK|MB_ICONEXCLAMATION "An existing installation of publiqa was found. Please uninstall it first, then restart the installer.$\r$\n$\r$\nWe are sorry for the inconvenience."
;Abort
ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
StrCmp $0 "" proceed 0
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}"
proceed:
!macroend
!macro customInit
; check whether there is an existing installation with the old GUID in registry
${checkInstOldGUIDFormat}
!macroend
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Any chance that a fix for bad installation entries will land in electron-builder, or do we all have to implement the same workarounds?
I also experencied this issue during an upgrade between 2 builds.
electron-builder in version 21.2.0 (electron 7.1.11)(https://github.com/thomaschampagne/elevate-alpha/releases/download/7.0.0-alpha.1/elevate_installer.exe)electron-builder in version 22.3.2 (electron 8.0.1)(https://github.com/thomaschampagne/elevate-alpha/releases/download/7.0.0-alpha.2/elevate_installer.exe)A fix for this problem is welcome 馃憤
Thanks!
I can confirm the above, it's happened again between versions 21 and 22 of electron builder. Our users are confused about why there are 2 entries. @develar any help here please?
The same happens for me between versions 21.1.5 and 22.3.2
Guys, need your advice: will this workaround work correctly? I tested for myself and everything works fine.
If I add custom nsh script where I just delete both registry entries. If they do not exist I think nothing will happen. Later during installation correct one will be added
!macro customInit
DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{${UNINSTALL_APP_KEY}}"
DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}"
!macroend
I have ended up with the following installer.nsh:
!define checkInstOldGUIDFormat "!insertmacro checkInstOldGUIDFormat"
!macro checkInstOldGUIDFormat
ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
StrCmp $0 "" 0 deleteHKCU
; check whether there is an admin installation with the old GUID format in registry, delete if exists
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
StrCmp $0 "" proceed deleteHKLM
deleteHKCU:
; delete HCKU +keys if exists
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}"
deleteHKLM:
; delete HKLM Keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}"
proceed:
!macroend
!macro customInit
; check whether there is an existing installation with the old GUID in registry
${checkInstOldGUIDFormat}
!macroend
Gracefully delete an existing registry keys, I assume this is okay.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Yes, this is still relevant. To move it forward, can we incorporate any of the above workaround in a PR?
It appears that the latest versions of electron-builder have reverted to the bracketless GUID format for consistency with older installations, however if an installation occurred with one of the affected releases, you will need to include one of the above fixes in your NSIS includes until you are reasonably sure all your users have upgraded and been cleaned-up by your include script.
Yep seeing the same. Had previously used a custom NSH script to remove the bracketless GUID, and had to update it to now look for the bracketted GUID and remove that instead... Maybe just stick with this format going forward? Pretty please lol
Here's the updated NSH script I'm using now to fix this latest regression:
```!define checkInstOldGUIDFormat "!insertmacro checkInstOldGUIDFormat"
!macro checkInstOldGUIDFormat
; Caused by changes in electron-builder in the PR 4069
; See issue https://github.com/electron-userland/electron-builder/issues/4092
; Note: Previously they switched from ### to {###} format, so we had to remove the version without curly braces.
; Recently they switched from {###} back to the ### format, reintroducing the bug... So now we have to fix it in reverse.
; Check whether there is a user installation with the old GUID format in registry and delete it
ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\{${UNINSTALL_APP_KEY}}" "QuietUninstallString"
StrCmp $0 "" 0 0
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\{${UNINSTALL_APP_KEY}}"
; Check whether there is an admin installation with the old GUID format in registry and delete it
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\{${UNINSTALL_APP_KEY}}" "QuietUninstallString"
StrCmp $0 "" proceed 0
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\{${UNINSTALL_APP_KEY}}"
proceed:
!macroend
!macro customInit
; check whether there is an existing installation with the old GUID in registry
${checkInstOldGUIDFormat}
!macroend
```
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Most helpful comment
We are also affected by the change introduced in #4069. FWIW, you can implement a workaround via custom NSIS script include, e.g. detect an old installation and abort with a message:
You can also implement a more fancy workaround, e.g. by calling the silent uninstall if available in reg entry:
or by simply deleting the reg key if your installer handles the old files correctly: