error emssage:
...
!define: "MUI_INSERT_NSISCONF"=""
Changing directory to: "C:\Users\Owner\Documents\Projects\Remove Empty Folder"
Processing script file: "1.nsi" (ACP)
Inner invocation (1.nsi:2)
OutFile: "C:\Users\Owner\AppData\Local\Temp\tempinstaller.exe"
SetCompress: off
Function: ".onInit"
SetSilent: silent
Error: command RequestExecutionLevel not valid in Function
Error in script "1.nsi" on line 38 -- aborting creation process
!makensis: returned 1, aborting
Error in script "C:\Users\Owner\Documents\Projects\Remove Empty Folder\1.nsi" on line 11 -- aborting creation process
Script: I am using the example .nsis script from https://nsis.sourceforge.io/Signing_an_Uninstaller
execput that I have comented out the signing line one line 21: "!system "SIGNCODE <signing options=""> $%TEMP%\uninstaller.exe" = 0</signing>
Other attempts:
a. If I take out the "RequestExecutionLevel user" line windows open a dialog to ask for permission to install while compling the installer.
b. If I place "RequestExecutionLevel user" outside a function the installer has trouble writing
"Error ropening file for writing: \uninstaller.exe. ... [Abort] [Retry] [Ignore].
c. If I write:
!ifdef INNER
RequestExecutionLevel user ; don't write uninstaller with admin permissions and prevent invoking UAC
!else
RequestExecutionLevel admin ; don't write uninstaller with admin permissions and prevent invoking UAC
!endif
I get the same failure "Error ropening file for writing: \uninstaller.exe ...
d. If I change
File $%TEMP%\uninstaller.exe
to
File c:\temp\uninstaller.exe
and:
WriteUninstaller "$%TEMP%\uninstaller.exe"
to
WriteUninstaller "c:\temp\uninstaller.exe"
I get the same error when running the installer.
Please assist.
Screen shot showing the installer failing to write \uninstaller.exe
Adding
InstallDir "$PROGRAMFILES\Remove Empty Folder – Planet Earth Software"
fixes this
So to fix the example wiki page about signing the unnistaller:
Add
InstallDir "$PROGRAMFILES\Test Install"
remove :
RequestExecutionLevel user ; don't write uninstaller with admin permissions and prevent invoking UAC
as it does not work inside the "Function .onInit"
added [not inside a function]:
!ifdef INNER
RequestExecutionLevel user ; don't write uninstaller with admin permissions and prevent invoking UAC
!else
RequestExecutionLevel admin ; don't write uninstaller with admin permissions and prevent invoking UAC
!endif
Run "C:\Program Files (x86)\Test Install\Uinstaller.exe" after installed as administartor to check that the uninstaller have been signed.
I'm relativly new to NSIS so do not want to edit the wiki page. Attached is the .nsis script that works [when the signtool line is completed by the developer]
You probably don't want to dynamically change RequestExecutionLevel.
Somebody had edited the wiki and placed RequestExecutionLevel in the wrong place.
My understanding is that the nsis run with /D INNER does not need to run a admin, if it is set like that it asks e user if it is ok to run as adminitarator which is not required.
The actual installer does need to run as administartor or you won't be able to write to C:\Prorgam Files etc...
My attach .nsi works.