0

I have an WiX installer configured like this:

<Property Id="MY_PROPERTY">

...

<Registry Name="MyValue" Type="multiString" Value="[MY_PROPERTY]" />

Now I want to pass this property value at the command line as a list:

MsiExec.exe /i MyInstaller.msi /qb MY_PROPERTY="One[~]Two[~]Three"

However, the installer does not split the values into a list and the literal value is written instead.

If I hard code the element it works properly:

<Registry Name="MyValue" Type="multiString" Value="One[~]Two[~]Three" />

Does anyone know how to specify a list of values at the command-line for a multiString registry value? Thanks in advance

2 Answers2

2

Better late than never! This can be achieved using a Custom Action.

Follow this MS document carefully: https://docs.microsoft.com/en-us/windows/win32/msi/registry-table

In your custom action, insert the registry value into MSI table from your property as follows,

Set db = Session.Database
set oView = db.OpenView("INSERT INTO `Registry` (`Registry`,`Root`,`Key`,`Name`,`Value`,`Component_`) VALUES ('reg_MY_PROPERTY', -1,'Software\Company\Product','MyValue','" & _
                            Session.Property("MY_PROPERTY") & "','CM_CP_BlahBlah') TEMPORARY")
oView.Execute
oView.Close

CM_CP_BlahBlah is your WIX component Registry values are attached to.

Please note "custom action must come before the RemoveRegistryValues and WriteRegistryValues actions in the action sequence"

<InstallExecuteSequence>
    <Custom Action="SetMyPropertyCustomAction" Before="RemoveRegistryValues">NOT REMOVE</Custom>
</InstallExecuteSequence>
0

REG_MULTI_SZ

A sequence of null-terminated strings, terminated by an empty string (\0). The following is an example: String1\0String2\0String3\0LastString\0\0 The first \0 terminates the first string, the second to the last \0 terminates the last string, and the final \0 terminates the sequence. Note that the final terminator must be factored into the length of the string.

So as per this LINK you should be doing this:

MY_PROPERTY="One\0Two\0Three\0"

For MULTISTRINGValues check this element: MULTISTRINGVALUE

Isaiah4110
  • 9,312
  • 1
  • 36
  • 53
  • reg ADD "HKLM\software\abc" /v abcd /t REG_MULTI_SZ /d "one \0two\0three\0" – Isaiah4110 Dec 11 '13 at 18:00
  • Yes, REG ADD works, but I'm looking for a way to have my WiX installer create this key with the multi-value based on the input from the command-line. – josemesona Dec 11 '13 at 18:12
  • I have tried setting the Action attribute to "append", "prepend", and "write". It always writes the literal value rather than splitting it into a list – josemesona Dec 11 '13 at 18:23
  • try this: http://wixtoolset.org/documentation/manual/v3/xsd/wix/multistringvalue.html – Isaiah4110 Dec 11 '13 at 19:06
  • Sorry this does not solve my issue. I tried the MultiStringValue element but then I have to split the property into multiple properties like MY_PROPERTY_1 etc. There does not appear to be a way to do what I want – josemesona Dec 11 '13 at 23:12
  • You can always write a custom action to format your property and split it to be used in the different MultiStringValue elements :) – Isaiah4110 Dec 12 '13 at 18:55