问题描述
再一次我被困在一个问题,那很可能是容易解决的。结果
我想扩展设置,与维克斯创建,使安装程序的配置文件中的变化。为了做到这一点,我已经创建了一个 CustomAction 。为了能够更改配置文件,我需要在我的 CustomAction 知道它的(请在安装)的位置。因此,我尝试过在 INSTALLLOCATION 和文件名我的 CustomAction 。这里躺着的问题: CustomActionData -Attribute总是空的,并设置抛出一个异常
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. In order to do this I've created a CustomAction. To be able to change the configuration file, I need to know the (install-)location of it within my CustomAction. Therefore I try passing the INSTALLLOCATION and Filename to my CustomAction. Here lies the problem: The CustomActionData-Attribute is always empty and the setup throws an exception.
我CustomAction是一个C#DLL文件: DemoDatumErzeugen.CA.dll
。它包含 DatumEintragen
的方法,它修改配置文件。我试图访问数据是这样的:
My CustomAction is a C# DLL file: DemoDatumErzeugen.CA.dll
. It contains a method DatumEintragen
which modifies the configuration file. I'm trying to access the data this way:
string path = session.CustomActionData["LOCATION"];
这是那里的异常。我只得到了德国的错误信息,但它说,沿着线的东西:提供的密钥并没有在字典中找到
(明镜angegebeneSchlüssel宾馆战争nicht IMWörterbuchangegeben
)
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.
).
这是我尝试如何通过从我的设置脚本属性,以我的自定义操作:
This is how I try passing the properties from my setup-script to my custom action:
<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>
我见过很多例子,有人做过同样的方式,或者至少非常相似。我尝试过很多事情,但似乎没有任何帮助像改变值℃之后,自定义操作=DemoDatum.SetProperty后=InstallFiles/>
。 CustomActionData总是零结果
我一下: session.CustomActionData.Count
结果
再次我对很感激任何帮助或者我做错了什么线索。
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"/>
. CustomActionData is always zero.
I check it with: session.CustomActionData.Count
Once again I'm pretty thankful for any help or hints where I've done something wrong.
推荐答案
的属性
属性 DemoDatum.SetProperty
应该等于编号
属性递延行动的价值。因此,要么更改属性名称 DemoDatum
,或更改递延行动编号
到 DatumEintragen
。
The Property
attribute value of DemoDatum.SetProperty
should be equal to the Id
attribute value of the deferred action. So, either change the property name to DemoDatum
, or change the Id
of the deferred action to DatumEintragen
.
这篇关于维克斯CustomActionData是被称为CustomAction空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!