InstallShield [PUBLIC] property passed to MSI on silent install?

105 views Asked by At

I'm trying to figure out why an InstallShield installation can install a component's files to the PUBLIC folder under normal installation, but not when silent (and running MSI with /qn).

Under normal installation, e.g. just running setup.exe manually, I believe the [PUBLIC] property is being resolved to the "User Public folder", e.g. C:\Users\. The files are then installed beneath this folder. Good.

But when I run the installer with /s (silent mode), and /v"/qn" (to get MSI to run without a user interface), the [PUBLIC] property is lost, and MSI defaults this to, I believe, C:\. The files are now in the 'wrong' place and the application then cannot find them. Not good.

We want to give the end-user a choice of either installing silently (hence the /s /v command line paramaters), or to perform a manual installation. But as I've explained, this results in the files going to one of two different folders.

Is this expected behaviour? Why does InstallShield seemingly pass on the [PUBLIC] property to MSI when being ran with a UI, but omits it when silent?

Is there a sensible fix for this? Maybe install to a different folder, say INSTALLDIR, might work better?

1

There are 1 answers

0
Eleco Martin On

So it turns out that MSI simply has no concept of the PUBLIC environment variable, which is where InstallShield is getting its value for [PUBLIC].

Instead you have a couple of choices:

  1. Pass a property's value into MSI directly, e.g. "/qn PUBLIC=\"path goes here\""
  2. Get InstallShield to set the property via a custom action. There is a SetProperty custom action type. Once the custom action has been created, put it into the InstallExecuteSequence so that it gets executed.

The second option is preferable since in InstallShield you can reference the environment variable setting, so if it changes, InstallShield can track the change at runtime. Referencing an environment variable has an unusual syntax, for example in my case it is [%PUBLIC]. Note the single % sign (not two), and the square brackets.

Oh, and the property was being passed to MSI when being installed with a UI because we already had a custom action to do this (see option 2), but that custom action was omitted from the execute sequence, hence didn't get called from a silent installation.