electron-builder nsis target include 选项定义的宏在打包期间调用,而不是在安装期间调用

electron-builder nsis target include option defined macros are called during packaging, not during installation

在 electron-builder 中,我在 build/installer.nsh 中添加了以下脚本来自定义 nsis 安装程序,但命令是在打包过程中执行的,而不是在安装程序安装过程中执行的。

!macro customHeader
  !system "echo 'customHeader' > ${BUILD_RESOURCES_DIR}\customHeader"
!macroend

!macro preInit
  !system "echo ${BUILD_RESOURCES_DIR} C:\resourcedirpath"
  !system "echo 'preInit' > ${BUILD_RESOURCES_DIR}\preInit"
!macroend

!macro customInit
  !system "echo 'customInit' > ${BUILD_RESOURCES_DIR}\customInit"
!macroend

!macro customInstall
  !system "echo 'customInstall' > ${BUILD_RESOURCES_DIR}\customInstall"
!macroend

!macro customUnInstall
  !system "echo 'customUnInstall' > ${BUILD_RESOURCES_DIR}\customUnInstall"
!macroend

感谢任何帮助。

!系统似乎运行在打包过程中。 我使用以下脚本来实现目标。

    FileOpen  "C:\path" a
    FileWrite  $EXEPATH
    FileClose 

使用 !system 的 Exec insted。我也遇到了同样的问题