Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installer which chooses the MSI based on the CPU architecture (x86 32-bit, x64 64-bit, etc)

I have an installer (Visual Studio setup project) which uses DIFxApp and an Orca transform to install drivers. The problem is that there are two DIFxApp merge modules - one for x86 and one for x64. If I reference both of them, the installation only works on 64-bit machines, whereas referencing only the x86 version allows me to install on 32-bit machines.

It seems as though the only solution is to create two MSIs (one for x86 and one for x64), each referencing the correct merge module. My question is how should I create an installer that chooses which MSI to install based off of the target machine's processor?

I've worked with NSIS a little bit, so it might be easiest to go that route. Other possibilities are Inno-Setup and dotNetInstaller.

Similar questions (but with inadequate answers):

  • launching correct installer for 32 and 64-bit apps
like image 252
Pat Avatar asked Nov 08 '10 21:11

Pat


2 Answers

If you decide to go with NSIS:

!include "x64.nsh"
${If} ${RunningX64}
   MessageBox MB_OK "running on x64"
${Else}
   MessageBox MB_OK "running on x86"
${EndIf}
like image 146
Anders Avatar answered Sep 23 '22 02:09

Anders


You can use a custom action to detect the OS, then call the right installer.

I've given an example here: single-msi-to-install-correct-32-or-64-bit-c-application

like image 31
Yochai Timmer Avatar answered Sep 20 '22 02:09

Yochai Timmer