Pass property to ISCmdBld.exe

605 Views Asked by At

I am using ISCmdBld.exe to build my installers on a remote machine and i need to specify different paths to INSTALLDIR. I need to do something like: -z INSTALLDIR="[ProgramFiles64Folder]\MyNewDir" and for 32bit -z INSTALLDIR="[ProgramFilesFolder]\MyNewDir". Currently if i try this it doesnt work because it will try to just pass in the literal string and not resolve the property in the brackets. I have tried it with/without the quotes to no avail.

Can we reference installshields built in directories?

1

There are 1 best solutions below

1
On BEST ANSWER

You cannot solve it this way. As you've seen, passing -z INSTALLDIR="[ParentFolder]Subdir" to ISCmdBld results in INSTALLDIR having that literal value. Why doesn't this work? In short, because it's not how Windows Installer works.

To understand what you need to accomplish, first build an MSI with your 32-bit parent folder, and then one with your 64-bit parent folder, and use a diff tool (such as InstallShield MSI Diff) to see how they differ. (Or really, you can do this on copies of the ISM, as this part is changed identically there.) You should see that in the Directory table, the directory parent structure for the INSTALLDIR record is changed. Refer to e.g. Rob Mensching's Deciphering the Msi Directory Table series if you don't understand the differences you see.

Unfortunately, there's no simple command-line approach to making this change at build time. So you have two main options:

  • Use some sort of automation (perhaps the ISWiProject's INSTALLDIR property in the InstallShield automation interface) to change the directory structure before building the project
  • Use set-directory custom actions to alter INSTALLDIR at run-time

    Note: Two such custom actions can choose between two alternative locations at run time by referencing in their conditions something you set elsewhere (such as a property via ISCmdBld).