简体   繁体   English

Nullsoft 安装程序 NSIS 未在欢迎页面上显示图像。 甚至不是默认的

[英]Nullsoft Installer NSIS not showing an image on the welcome page. Not even the default one

I'm trying to write an NSIS script using MUI2 and for some reason it refuses to show an image on the welcome page.我正在尝试使用 MUI2 编写 NSIS 脚本,但由于某种原因它拒绝在欢迎页面上显示图像。 I have tried using MUI_WELCOMEFINISHPAGE_BITMAP as instructed in the NSIS wiki and manual.我尝试按照 NSIS wiki 和手册中的说明使用 MUI_WELCOMEFINISHPAGE_BITMAP。 I have used ${NSISDIR} to reference the included bitmaps.我使用 ${NSISDIR} 来引用包含的位图。 I have tried using a full path to the included bitmaps.我尝试使用包含位图的完整路径。 I have tried using a path to a bitmap in my installation files directory.我尝试在我的安装文件目录中使用 bitmap 的路径。

No matter what I do, I end up with a Welcome page that has a title and text, but no image.无论我做什么,我都会得到一个欢迎页面,该页面有标题和文本,但没有图像。 The build process gives no warnings or errors concerning the welcome bitmap.构建过程没有给出关于欢迎 bitmap 的警告或错误。 The installer installs everything correctly.安装程序会正确安装所有内容。 There's just no image on the welcome page and I cannot figure out why.欢迎页面上没有图像,我不知道为什么。

This is my first attempt at using NSIS, so there's probably something I'm missing.这是我第一次尝试使用 NSIS,所以我可能缺少一些东西。 The section of my.nsi file with the page definitions is below.带有页面定义的 my.nsi 文件部分如下所示。 Any help would be appreciated.任何帮助,将不胜感激。

!include MUI2.nsh

# Install Warcraft II BattleNet Edition and dependencies.
Name "Warcraft II Windows 10 Setup"
Outfile "Warcraft Win10 Setup.exe"
InstallDir "C:\ISO"
# !define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!define MUI_WELCOMEPAGE_TITLE "Warcraft II for Windows 10"
!define MUI_WELCOMEPAGE_TEXT "Ready to work!$\r$\n$\r$\nWith just a few simple steps, our peons will have you ready to play Warcraft II on Windows 10."
!insertmacro MUI_PAGE_WELCOME
!define MUI_DIRECTORYPAGE_TEXT_TOP "Choose a location to store the Warcraft II CD-ROM (ISO) image."
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "ISO Image Folder"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_TEXT "Work complete!"
!insertmacro MUI_PAGE_FINISH

I found the solution and am posting for anyone else experiencing the same problem.我找到了解决方案,并为遇到同样问题的其他人发帖。

In short, the answer is: !insertmacro MUI_LANGUAGE "English"简而言之,答案是:!insertmacro MUI_LANGUAGE "English"

Apparently, one must specify a language for a bitmap to show up.显然,必须为 bitmap 指定一种语言才能显示。 Makes total sense, huh?完全有道理,对吧? And yes, Virginia, that was sarcasm.是的,弗吉尼亚,那是讽刺。

I figured this out by taking the example from the website below and commenting lines out until I reproduced my problem with the lack of a bitmap image appearing on the welcome page.我通过从下面的网站中获取示例并注释行来解决这个问题,直到我重现了我的问题,即欢迎页面上缺少 bitmap 图像。

https://nsis.sourceforge.io/Examples/Modern%20UI/WelcomeFinish.nsi https://nsis.sourceforge.io/Examples/Modern%20UI/WelcomeFinish.nsi

The working code looks like this:工作代码如下所示:

!include MUI2.nsh

# Install Warcraft II BattleNet Edition and dependencies.
Name "Warcraft II Windows 10 Setup"
Outfile "Warcraft Win10 Setup.exe"
InstallDir "C:\ISO"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!define MUI_WELCOMEPAGE_TITLE "Warcraft II for Windows 10"
!define MUI_WELCOMEPAGE_TEXT "Ready to work!$\r$\n$\r$\nWith just a few simple steps, our peons will have you ready to play Warcraft II on Windows 10."
!insertmacro MUI_PAGE_WELCOME
!define MUI_DIRECTORYPAGE_TEXT_TOP "Choose a location to store the Warcraft II CD-ROM (ISO) image."
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "ISO Image Folder"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_TEXT "Work complete!"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"

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

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