Andy Arismendi
Andy Arismendi

Reputation: 52689

Dynamic property value with InstallShield 2010 and basic MSI

In XML File Changes, I want to set a node content's to be [MYPUBLICPROPERTY1] so this can be passed in via command line e.g. msiexec /i my.msi MYPUBLICPROPERTY1="Foo". However if it is not passed in via command line I want it to be [INSTALLDIR]Sub\Path.

Any ideas to achieve this result?

Upvotes: 1

Views: 824

Answers (1)

Stein Åsmul
Stein Åsmul

Reputation: 42226

See if this answer clarifies general things related to your question: How can I have a WiX Property default to null?

As to your requirement. Use a custom action after CostFinalize (directories resolved) to set MYPUBLICPROPERTY1 to [INSTALLDIR]Sub\Path. Include logic in the custom action to not overwrite the property if it is already set by command line (just read the property and check if it is empty). Leave the property out of the Property table. I am not sure if Installshield automatically adds it to the property table if you use it in XML File Changes. If so, scan to see if it has been overridden by command line (add default dummy value in property table), and if it hasn't, set it to the directory you need it to be. If this is not possible, abort the setup.

Upvotes: 1

Related Questions