Search code examples
windows-installerpackagensis

Can NSIS be used to package MSI installers?


I have two MSI installers for 32 bit and 64 bit platforms, and I'd like to create a single installer to ship that will run the appropriate MSI based on the platform it's being run on. I appreciate that this is not possible with MSI alone.

The package required is very simple, just check the bit-ness of the platform it's running on and launch the appropriate MSI, but I haven't yet found any free tools that will do this. I've come across NSIS, which looks promising, does anyone know if it is appropriate for this task?


Solution

  • Use x64.nsh to detect the platform and then extract & execute. Something like this:

    !include x64.nsh
    Section
    Initpluginsdir
    ${If} ${RunningX64}
      File "/oname=$pluginsdir\inst.msi" "myfiles\amd64.msi"
    ${Else}
      File "/oname=$pluginsdir\inst.msi" "myfiles\x86.msi"
    ${EndIf}
    ExecWait '"msiexec" /i "$pluginsdir\inst.msi"'
    SectionEnd