'Not able to register and unregister .dll file through electron-builder custom NSIS include script
I have created a electron desktop app and created a installer using electron-builder.
Now I want to add capability of registering a .dll file at the time of installation of my desktop app and unregistering it at the time of uninstallation.
My installer.nsh file is
!macro customInstall
Exec "regsvr32.exe $INSTDIR\resources\app.asar.unpacked\node_modules\obs-studio-node\obs-virtualsource.dll"
!macroend
!macro customUnInstall
Exec "regsvr32.exe /u $INSTDIR\resources\app.asar.unpacked\node_modules\obs-studio-node\obs-virtualsource.dll"
!macroend
My electron-builder config is
"build": {
"nsis": {
"include": "installer.nsh"
},
"mac": {
"icon": "build/icon.png"
},
"win": {
"icon": "build/icon.png"
}
}
But this is not working for me. I have tried both Exec and ExecWait none is working.
What I am missing to make it working?
Solution 1:[1]
Are you running the installer as admin? Registering the .dll requires administrator rights.
Set admin rights in your script first with:
RequestExecutionLevel admin
Solution 2:[2]
Try the below options,
!macro customInstall
Exec "regsvr32.exe
$INSTDIR\resources\app.asar.unpacked\node_modules\obs-studio-node\obs-virtualsource.dll"
!macroend
!macro customUnInit
Exec "regsvr32.exe /u
$INSTDIR\resources\app.asar.unpacked\node_modules\obs-studio-node\obs-virtualsource.dll"
!macroend
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Slappy |
| Solution 2 | Raams |
