[英]Require Component Installation with MUI
作為一個新的 NSIS 用戶,到目前為止,我默認使用 HM NIS 編輯向導來創建我的安裝程序。 默認輸出利用了 MUI,這對我來說非常有用。 但是,它還包含來自 MUI 宏庫的組件頁面,因此我無法挑選和選擇哪些組件是必需的。 我看過這個問題: 如何在 NSIS 腳本中強制使用 SectionGroup ,但我不確定將它放在下面的代碼中的什么位置,甚至不確定如何修改向導的輸出代碼以包含它。 安裝程序適用於具有不同(可選)可執行文件的多個應用程序,這些可執行文件都需要相同(理想情況下是強制性的)支持文件。
; 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
簡而言之,我需要知道如何在不丟失 GUI 的情況下強制執行Support Files
部分。 不過,我唯一的經驗是使用上述向導。
SectionIn
指令用於分配節以安裝類型(組件頁面上的組合框),但它也可以使節只讀:
Section "Support Files" SEC01
SectionIn RO ;Make it read-only
SetOutPath "$INSTDIR"
SetOverwrite try
File "..\Support\File\Path\file.txt"
SectionEnd
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.