Phil Hannent
Phil Hannent

Reputation: 12327

How do I take a command line parameter and add it to the registry using wix installer?

I have a WIX installer script and I want to be able to let the user of the resultant MSI file to be able to set the default language, product key and user information during that command line call.

How do I use the command line parameter in my XML file so that its written to the registry?

Upvotes: 1

Views: 879

Answers (1)

Yan Sklyarenko
Yan Sklyarenko

Reputation: 32280

You can pass property values as a command line parameters to msiexec. If I remember correctly, those should be public properties (names all uppercased). For instance:

msiexec /i myproduct.msi LANG=en PRODUCTKEY=mycompany USER=admin

In WiX code, you can reference those as usual properties, just like if you define them in the code. Note that you should handle the situation when a property value is not passed or passed data is not what you expect. You can either terminate the installation and ask user to provide appropriate data, or live with default values.

In order to write those property values to registry, use the usual approach with RegistryKey/RegistryValue elements.

Upvotes: 2

Related Questions