简体   繁体   English

NSIS安装程序MUI_ICON语句被忽略

[英]NSIS installer MUI_ICON statement ignored

I am attempting to build an exe file using NSIS on Windows 8.1. 我正在尝试在Windows 8.1上使用NSIS构建exe文件。 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: 我无法使用以下语句将正确的图标分配给exe文件:

!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). 包含MUI_PAGE_WELCOME的不良后果(令人费解的)是无法在用户执行级别启动安装程序(运行安装程序exe时没有窗口出现,尽管将鼠标悬停在底部任务栏中的图标上会显示空白窗口)。 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. 对于我的生活,我无法弄清楚MUI_PAGE_WELCOME和MUI_ICON之间的依赖性以及使用前者作为Admin运行exe的需要。

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. 我可以告诉您,使用MUI时,您必须插入至少一个MUI_PAGE_ *宏和至少一个MUI_LANGUAGE宏。 One of these macros will basically just do Icon "${MUI_ICON}" to set the icon but that is an implementation detail. 这些宏之一基本上只是执行Icon "${MUI_ICON}"来设置图标,但这只是实现细节。

To control UAC elevation requests you should use the RequestExecutionLevel attribute. 要控制UAC提升请求,您应该使用RequestExecutionLevel属性。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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