WiX CustomActionData 在调用的 CustomAction 中为空

2024-01-25

我再次陷入了一个问题,这可能很容易解决。
我想扩展使用 WiX 创建的设置,以更改已安装程序的配置文件。为了做到这一点,我创建了一个自定义动作。为了能够更改配置文件,我需要知道它在我的文件中的(安装)位置自定义动作。因此我尝试通过安装位置和文件名到我的自定义动作。问题就在这里:自定义操作数据-属性始终为空并且设置会引发异常。

我的 CustomAction 是一个 C# DLL 文件:DemoDatumErzeugen.CA.dll。它包含一个方法DatumEintragen它修改配置文件。我正在尝试以这种方式访问​​数据:

string path = session.CustomActionData["LOCATION"];

这是抛出异常的地方。我只收到德语错误消息,但它说的是这样的内容:The supplied key was not found in the dictionary (Der angegebene Schlüssel war nicht im Wörterbuch angegeben.).

这是我尝试将属性从我的设置脚本传递到我的自定义操作的方法:

<Binary Id="DemoDatumEinrichtenCA" SourceFile="DemoDatumErzeugen.CA.dll"/>

<CustomAction Id="DemoDatum.SetProperty" Return="check" Property="DatumEintragen" Value="LOCATION=[INSTALLLOCATION];NAME=StrategieplanConfig.xml;"/>
<CustomAction Id="DemoDatum" BinaryKey="DemoDatumEinrichtenCA" DllEntry="DatumEintragen" Execute="deferred" Return="check" HideTarget="no"/>

<InstallExecuteSequence>
  <Custom Action="DemoDatum.SetProperty" After="InstallFiles"/>
  <Custom Action="DemoDatum" After="DemoDatum.SetProperty"/>
</InstallExecuteSequence>

我见过很多以相同方式或至少非常相似的方式完成的例子。我尝试了很多方法,但似乎没有什么比更改 After in 的值更有帮助<Custom Action="DemoDatum.SetProperty" After="InstallFiles"/>。 CustomActionData 始终为零。
我用以下方法检查:session.CustomActionData.Count
我再次非常感谢任何帮助或提示我做错了什么。


The Property的属性值DemoDatum.SetProperty应等于Id延迟操作的属性值。因此,要么将属性名称更改为DemoDatum,或更改Id推迟行动的DatumEintragen.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

WiX CustomActionData 在调用的 CustomAction 中为空 的相关文章

随机推荐