0
作爲新的NSIS用戶,我默認使用HM NIS Edit嚮導創建我的安裝程序。默認輸出利用了MUI,這對我來說非常有用。但是,它也包含來自MUI宏庫的組件頁面,所以我無法選擇和選擇哪些組件是必需的。我已經看過這個問題:How to make a SectionGroup mandatory in NSIS script,但我不確定將它放在下面的代碼中,甚至不知道如何修改嚮導的輸出代碼以包含它。安裝程序適用於具有不同(可選)可執行文件的多個應用程序,這些應用程序都需要相同的(理想情況下必需的)支持文件。要求使用MUI安裝組件
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Product"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\App1.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\Product"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Section "Support Files" SEC01
SetOutPath "$INSTDIR"
SetOverwrite try
File "..\Support\File\Path\file.txt"
SectionEnd
Section "App1" SEC02
SetOutPath "$INSTDIR"
SetOverwrite try
File "..\App1\File\Path\App1.exe"
SectionEnd
Section "App2" SEC03
SetOutPath "$INSTDIR"
SetOverwrite try
File "..\App2\File\Path\App2.exe"
SectionEnd
總之,我需要知道如何讓Support Files
部分強制性,又不失GUI。但我唯一的經驗就是上述的巫師。