使用 NSIS 自定义安装程序图标

Installer icon customization with NSIS

我正在使用 NSIS 创建安装程序。现在输出文件 installer.exe 具有标准图标,可以在以下位置找到:

{NSIS_Install_Dir}\Contrib\Graphics\Icons\classic-install.ico

我想用自定义矿井更改它,所以我按照文档的建议添加了这些行:

!include "MUI.nsh"
!define MUI_ICON "custominstaller.ico"
!define MUI_UNICON "custominstaller.ico"

它不起作用,在 NSIS 编译结束时我可以看到 2 个警告:

2 warnings:
  Variable "MUI_TEMP1" not referenced or never set, wasting memory!
  Variable "MUI_TEMP2" not referenced or never set, wasting memory!

我尝试使用 MUI2.nsh 但实际上没有任何变化(只是新警告)。我也尝试使用图标的完整路径,但仍然没有。 我什至将标准 NSIS 图标之一(箭头-install.ico)复制到 C:\ 并将其引用为

!define MUI_ICON "C:\arrow-install.ico"

仍然没有。有什么提示吗?

我在 Windows 7 机器上使用 NSIS 3.01。

在这里回答我自己的问题,终于找到了答案。
我正在使用 MUI2.nsh 并且 必须 插入宏 MUI_LANGUAGE,例如:

!insertmacro MUI_LANGUAGE "English"

没有它插件将无法正常工作。荒谬的是,文档中没有任何地方说明这一点,但仅此而已。

来源:A heap of warnings and no image on the welcome/finish page