5

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):

Community
  • 1
  • 1
Pat
  • 16,515
  • 15
  • 95
  • 114
  • Why not let the user choose the right MSI? It's pretty common in the Windows world to have separate installers for 32-bit and 64-bit versions. – Dirk Vollmar Nov 08 '10 at 21:14
  • @0xA3: Because the customer wants one unified installer. Besides, I feel that it is better to automate everything possible so that the user has to do as little as possible to get it installed. – Pat Nov 08 '10 at 21:18

3 Answers3

19

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}
Anders
  • 97,548
  • 12
  • 110
  • 164
2

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

Community
  • 1
  • 1
Yochai Timmer
  • 48,127
  • 24
  • 147
  • 185
0

How about making a small program (launcher) that detect the os type (64 0r 32 bit, should be easy). The little program then launch the correct installer depending on detection result. The program shouldn't has any window and has the same icon as the installer. Just give the customer all three files, installer.exe (the program), inst32.msi and inst64.msi. If that's too much for your customer then just compress them to a self extracting zip that launch the installer.exe automatically.

arifwn
  • 131
  • 8
  • Yes, that's a valid solution, but this is a problem that has been solved by others and I'd rather not reinvent the wheel. – Pat Nov 08 '10 at 22:56
  • In that case I recommend inno setup, very easy to use http://www.jrsoftware.org/isinfo.php . Personally i think inno setup is easier than nsis. – arifwn Nov 08 '10 at 23:05
  • I installed and am looking at IS right now. I'm willing to try it, but I don't know where to start. A good answer to my original question would explicitly walk through choosing one file or another based off of the CPU. – Pat Nov 08 '10 at 23:07
  • Inno setup has many template scipts you can reuse. It easier to reuse them than write it from scratch. The documentation is very clear too IMO. This forum post might solve your problem: http://www.vbforums.com/showthread.php?t=596012 – arifwn Nov 08 '10 at 23:10
  • IIRC, the variable with that information is called "Is64BitInstallMode", because the user can choose to install 32Bit on 64Bit by commandline. – lImbus Nov 09 '10 at 11:04