使用一个NSIS安装程序可以在32位OS上安装32位二进制文件,并在64位OS上安装64位二进制文件吗? [英] Use one NSIS installer to install 32-bit binaries on 32-bit OS and 64-bit binaries on 64-bit OS possible?
问题描述
我目前为我维护的产品有两个WIX安装程序.一种用于32位操作系统,另一种用于64位操作系统.与其维护两个单独的安装程序,不如将它们组合到一个NSIS安装程序中,该安装程序可以确定"操作系统的位",然后将适当的二进制文件复制到程序目录中.有没有人对此有任何经验,可以提供NSIS可以用来制作安装程序的示例脚本?
I currently have two WIX installers for a product that I maintain. One for 32-bit operating systems, and one for 64-bit operating systems. Instead of maintaining two separate installers, I want to combine them into one NSIS installer that can "determine" the "bitness" of the OS and then copy the appropriate binaries into the program directory. Has anyone had any experience with this and could provide a working sample script that NSIS can use to make the installer?
推荐答案
x64.nsh 具有一些帮助程序宏,您可以安装到$programfiles32
或$programfiles64
x64.nsh has some helper macros and you can install into $programfiles32
or $programfiles64
Function .onInit
StrCpy $instdir $programfiles32\MyApp
${If} ${RunningX64}
StrCpy $instdir $programfiles64\MyApp
${EndIf}
FunctionEnd
...
Section
Setoutpath $instdir
${If} ${RunningX64}
File /r build\64\*
${Else}
File /r build\32\*
${EndIf}
SectionEnd
这篇关于使用一个NSIS安装程序可以在32位OS上安装32位二进制文件,并在64位OS上安装64位二进制文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!