通过命令行将 multiString 值传递给安装程序 [英] Passing multiString values to installer through command-line
问题描述
我有一个这样配置的 WiX 安装程序:
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" />
有谁知道如何在命令行中为 multiString 注册表值指定值列表?提前致谢
Does anyone know how to specify a list of values at the command-line for a multiString registry value? Thanks in advance
推荐答案
迟到总比不到好!这可以使用自定义操作来实现.
Better late than never! This can be achieved using a Custom Action.
仔细遵循此 MS 文档:https://docs.microsoft.com/en-us/windows/win32/msi/registry-table
Follow this MS document carefully: https://docs.microsoft.com/en-us/windows/win32/msi/registry-table
在您的自定义操作中,将注册表值从您的属性插入 MSI 表,如下所示,
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 是附加到您的 WIX 组件注册表值.
CM_CP_BlahBlah is your WIX component Registry values are attached to.
请注意自定义操作必须位于操作序列中的 RemoveRegistryValues 和 WriteRegistryValues 操作之前"
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>
这篇关于通过命令行将 multiString 值传递给安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!