【问题标题】:Require Component Installation with MUI需要使用 MUI 安装组件
【发布时间】:2013-08-21 18:15:41
【问题描述】:

作为一个新的 NSIS 用户,到目前为止,我默认使用 HM NIS 编辑向导来创建我的安装程序。默认输出利用了 MUI,这对我来说非常有用。但是,它还包括来自 MUI 宏库的组件页面,因此我无法挑选哪些组件是强制性的。我看过这个问题:How to make a SectionGroup mandatory in NSIS script,但我不确定将它放在下面的代码中的哪个位置,甚至不确定如何修改向导的输出代码以包含它。安装程序适用于具有不同(可选)可执行文件的多个应用程序,这些应用程序都需要相同(理想情况下是强制性的)支持文件。

; 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。不过,我唯一的经验是使用上述向导。

【问题讨论】:

    标签: nsis nsis-mui


    【解决方案1】:

    SectionIn 指令用于分配节以安装类型(组件页面上的组合框),但它也可以将节设为只读:

    Section "Support Files" SEC01
      SectionIn RO ;Make it read-only
      SetOutPath "$INSTDIR"
      SetOverwrite try
      File "..\Support\File\Path\file.txt"
    SectionEnd
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-08
      • 2020-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-21
      相关资源
      最近更新 更多