問題描述
Instal versi Firebird yang benar (32bit atau 64bit) dengan Inno Setup (Install correct version of Firebird (32bit or 64bit) with Inno Setup)
I have an Inno Script installer that gave the user the option of installing only the 32 bit version of Firebird. Now that i have a 64bit machine and have used the 6 bit Firebird to confirm that my app works with it I want my installer to show the 32 bit Firebird installer on 32bit platforms and the 64bit installer on 64bit platforms.
In the Install Actions section I am showing a checkbox for the Firebird installer, thus giving the user the option of installing it if it is not installed or not running the Firebird install if they already have it.
This is from my script:
[Run]
Filename: {app}\Firebird‑2.5.1.26351_1_x64.exe; Parameters: "/SILENT /NOCPL"; WorkingDir: {app}; Flags: postinstall skipifsilent 64bit; Check: Is64BitInstallMode;
Filename: {app}\Firebird‑2.5.1.26351_1_Win32.exe; Parameters: "/SILENT /NOCPL"; WorkingDir: {app}; Flags: postinstall skipifsilent 32bit; Check: "not Is64BitInstallMode";
The problem is, only the 32bit installer shows on the dialog form.
Both files are included so that both are available during my app install:
[Files]
Source: ..\Firebird‑2.5.1.26351_1_x64.exe; DestDir: {app}
Source: ..\Firebird‑2.5.1.26351_1_Win32.exe; DestDir: {app}
How can I get my installer to show the 64bit Firebird installer on 64bit platforms?
Thanks
‑‑‑‑‑
參考解法
方法 1:
There's an example of doing exactly this (installing the 32‑bit version on Win32 or 64‑bit on Win64) in the Examples\64BitTwoArch.iss
file that's installed with InnoSetup.
; ‑‑ 64BitTwoArch.iss ‑‑
; Demonstrates how to install a program built for two different
; architectures (x86 and x64) using a single installer.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output
; "ArchitecturesInstallIn64BitMode=x64" requests that the install be
; done in "64‑bit mode" on x64, meaning it should use the native
; 64‑bit Program Files directory and the 64‑bit view of the registry.
; On all other architectures it will install in "32‑bit mode".
ArchitecturesInstallIn64BitMode=x64
; Note: We don't set ProcessorsAllowed because we want this
; installation to run on all architectures (including Itanium,
; since it's capable of running 32‑bit code too).
[Files]
; Install MyProg‑x64.exe if running in 64‑bit mode (x64; see above),
; MyProg.exe otherwise.
Source: "MyProg‑x64.exe"; DestDir: "{app}"; DestName: "MyProg.exe"; Check: Is64BitInstallMode
Source: "MyProg.exe"; DestDir: "{app}"; Check: not Is64BitInstallMode
Source: "MyProg.chm"; DestDir: "{app}"
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
[Icons]
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
(by GreatDayDan、Ken White)