简体   繁体   English

WiX CustomActionData在名为CustomAction的位置为空

[英]WiX CustomActionData is empty in called CustomAction

once again I'm stuck at a problem, that is probably easy to solve. 再一次,我遇到了问题,这可能很容易解决。
I want to extend a setup, created with WiX, to make changes in the configuration file of the installed program. 我想扩展一个使用WiX创建的设置,以便对已安装程序的配置文件进行更改。 In order to do this I've created a CustomAction . 为了做到这一点,我创建了一个CustomAction To be able to change the configuration file, I need to know the (install-)location of it within my CustomAction . 为了能够更改配置文件,我需要知道它在CustomAction中的(安装)位置。 Therefore I try passing the INSTALLLOCATION and Filename to my CustomAction . 因此,我尝试将INSTALLLOCATION和Filename传递给我的CustomAction Here lies the problem: The CustomActionData -Attribute is always empty and the setup throws an exception. 这就出现了问题: CustomActionData -Attribute始终为空,安装程序抛出异常。

My CustomAction is a C# DLL file: DemoDatumErzeugen.CA.dll . 我的CustomAction是一个C#DLL文件: DemoDatumErzeugen.CA.dll It contains a method DatumEintragen which modifies the configuration file. 它包含一个修改配置文件的方法DatumEintragen I'm trying to access the data this way: 我试图以这种方式访问​​数据:

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

This is where the exception is thrown. 这是引发异常的地方。 I only got the German error message, but it says something along the lines: The supplied key was not found in the dictionary ( Der angegebene Schlüssel war nicht im Wörterbuch angegeben. ). 我只收到了德语错误信息,但它说了一句话: The supplied key was not found in the dictionaryDer angegebene Schlüssel war nicht im Wörterbuch angegeben. )。

This is how I try passing the properties from my setup-script to my custom action: 这是我尝试将属性从我的setup-script传递到自定义操作的方法:

<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>

I've seen many examples where it was done the same way or at least very similar. 我已经看过很多例子,它们以相同的方式完成,或者至少非常相似。 I've tried many things but nothing seems to help like changing the value After in <Custom Action="DemoDatum.SetProperty" After="InstallFiles"/> . 我已经尝试了很多东西,但似乎没有什么比在<Custom Action="DemoDatum.SetProperty" After="InstallFiles"/>之后更改值<Custom Action="DemoDatum.SetProperty" After="InstallFiles"/>帮助。 CustomActionData is always zero. CustomActionData始终为零。
I check it with: session.CustomActionData.Count 我检查它: session.CustomActionData.Count
Once again I'm pretty thankful for any help or hints where I've done something wrong. 再一次,我非常感谢任何帮助或提示我做错了什么。

The Property attribute value of DemoDatum.SetProperty should be equal to the Id attribute value of the deferred action. DemoDatum.SetPropertyProperty属性值应等于延迟操作的Id属性值。 So, either change the property name to DemoDatum , or change the Id of the deferred action to DatumEintragen . 因此,要么将属性名称更改为DemoDatum ,要么将延迟操作的Id更改为DatumEintragen

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM