简体   繁体   中英

NSIS installer MUI_ICON statement ignored

I am attempting to build an exe file using NSIS on Windows 8.1. The installer must run at User level (and not Admin as that breaks other things).

I'm unable to assign the correct icon to the exe file using the following statements:

!include MUI2.nsh
!define MUI_ICON  "path_to_icon.ico file"

The above doesn't work unless I also include the following:

!insertmacro MUI_PAGE_WELCOME

The undesirable - and puzzling - side-effect of including MUI_PAGE_WELCOME is the inability to launch the installer at User execution level (no window appears when installer exe is run, although hovering your mouse over the icon in the task bar at the bottom shows a blank window). If I invoke the installer using Run as Adminstrator, it launches (window does display and files are installed) but causes the launched application to run in Admin mode (undesirable).

For the life in me, I can't figure out the dependency between MUI_PAGE_WELCOME and MUI_ICON and the need to run the exe as Admin if using the former.

Has anyone else encountered this issue?

Without a full example I can actually compile it is hard to know what is going on here.

I can tell you that when using the MUI you have to insert at least one MUI_PAGE_* macro and at least one MUI_LANGUAGE macro. One of these macros will basically just do Icon "${MUI_ICON}" to set the icon but that is an implementation detail.

To control UAC elevation requests you should use the RequestExecutionLevel attribute.

Outfile "Test.exe"
RequestExecutionLevel user

!include MUI2.nsh
!define MUI_ICON "myicon.ico"

!insertmacro MUI_PAGE_WELCOME ; Commenting out this line has no effect on the icon nor UAC elevation
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English

Section
SectionEnd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM