Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WiX-将多个属性提交到延迟的自定义操作_Wix_Installation_Custom Action_Wix3.6_Wix Extension - Fatal编程技术网

WiX-将多个属性提交到延迟的自定义操作

WiX-将多个属性提交到延迟的自定义操作,wix,installation,custom-action,wix3.6,wix-extension,Wix,Installation,Custom Action,Wix3.6,Wix Extension,我的WiX安装程序在与延迟/立即自定义操作联系时遇到问题。请原谅我的英语 我想将用户输入的一些属性交给延迟的自定义操作。我知道我需要一个即时的自定义操作和“CustomActionData”来实现这一点。我已经用这种方式实现了它 二进制文件: <Binary Id='myAction' SourceFile='.\TemplateGeneration.CA.dll'/> 我的问题: 如果我试图安装我的程序,它就会中断。 使用此代码,我只能放弃一个属性,但我需要提交多个属性 有关信

我的WiX安装程序在与延迟/立即自定义操作联系时遇到问题。请原谅我的英语

我想将用户输入的一些属性交给延迟的自定义操作。我知道我需要一个即时的自定义操作和“CustomActionData”来实现这一点。我已经用这种方式实现了它

二进制文件:

<Binary Id='myAction'  SourceFile='.\TemplateGeneration.CA.dll'/>
我的问题: 如果我试图安装我的程序,它就会中断。 使用此代码,我只能放弃一个属性,但我需要提交多个属性

有关信息: 当我查看日志文件时,自定义操作调用时会出现System.Collections.Generic.KeyNotFoundException

为什么这不起作用? 嗯,我需要延迟的自定义操作写入“程序文件文件夹”。由于所需的权限,需要延迟的自定义操作,并且在延迟之前执行的即时自定义操作应有助于处理属性。有可能吗


我希望您了解我的问题所在,并且您可以尝试帮助我。

首先,您将数据从即时自定义操作传递到延迟自定义操作的方式存在错误。在即时自定义操作中使用的
属性的名称必须与延迟自定义操作的
Id
完全相同。就你而言:

<!-- immediate CA -->
<CustomAction Id='Datenuebergabe' Property='DoSomething' Value='InstalllocVar=[INSTALLLOCATION]'/>

<!-- deferred CA -->
<CustomAction Id='DoSomething' BinaryKey ='myAction' DllEntry='DoSomething' Impersonate='no' Execute='deferred'  Return='check' HideTarget='yes'/>
如您所见,这里有两个名称-值对传递给延迟CA,
source
target
。在延迟CA中,使用以下代码取出这些值:

var source=session.CustomActionData[“source”];
var target=session.CustomActionData[“target”];

就这样。

谢谢,这是有道理的,目前看来它确实有效。但是,为了在安装文件后启动,我必须按哪个顺序调用即时自定义操作?是否有办法实现此功能?安装文件后无法立即启动操作。这就是为什么它被称为immediate-当Windows Installer代理在处理过程中访问它时,它会立即执行。即时CA的设计目的是从系统、环境和用户收集信息,有选择地对其进行验证并传递给延迟序列以供实际执行。即时CA决不能更改目标系统状态。除非延迟操作决定,否则无法找到安装模板所需的文件。。嗯…@Yansklayarenko如何从CustomAction@asvignesh将值发送回Wix,我认为这值得一个单独的问题,因为这一问题没有涉及。
<CustomAction Id='TemplateGenerationInstallKey' BinaryKey ='myAction' DllEntry='DoSomething' Impersonate='no' Execute='deferred'  Return='check' HideTarget='yes'/>
 <InstallExecuteSequence>

  <Custom Action="Datenuebergabe" Sequence="1399"/>
  <Custom Action="TemplateGenerationInstallKey" Before="InstallFinalize"/>

 </InstallExecuteSequence>
string somedata = session.CustomActionData["InstalllocVar"];
TemplateEngineCall(somedata+"templates", "install_key_cmd", somedata+"scripts", "install_key.cmd");
<!-- immediate CA -->
<CustomAction Id='Datenuebergabe' Property='DoSomething' Value='InstalllocVar=[INSTALLLOCATION]'/>

<!-- deferred CA -->
<CustomAction Id='DoSomething' BinaryKey ='myAction' DllEntry='DoSomething' Impersonate='no' Execute='deferred'  Return='check' HideTarget='yes'/>
<CustomAction Id="SetForDoSomething" Return="check" Property="DoSomething" Value="source=[ArchiveFolder][ARCHIVENAME];target=[WebsiteFolder]"/>