小编Sch*_*jen的帖子

WiX - 提交多个属性以延迟自定义操作

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

我想将用户输入的一些属性交给延迟的自定义操作.我知道我需要一个立即的自定义操作和"CustomActionData"来做到这一点.我是以这种方式实施的.

二进制文件:

<Binary Id='myAction'  SourceFile='.\TemplateGeneration.CA.dll'/>
Run Code Online (Sandbox Code Playgroud)

即时自定义操作:

<CustomAction Id='Datenuebergabe' Property='DoSomething' Value='InstalllocVar=[INSTALLLOCATION]'/>
Run Code Online (Sandbox Code Playgroud)

延迟的自定义操作:

<CustomAction Id='TemplateGenerationInstallKey' BinaryKey ='myAction' DllEntry='DoSomething' Impersonate='no' Execute='deferred'  Return='check' HideTarget='yes'/>
Run Code Online (Sandbox Code Playgroud)

InstallExecuteSequence

 <InstallExecuteSequence>

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

 </InstallExecuteSequence>
Run Code Online (Sandbox Code Playgroud)

在延迟的自定义操作中调用属性:

string somedata = session.CustomActionData["InstalllocVar"];
TemplateEngineCall(somedata+"templates", "install_key_cmd", somedata+"scripts", "install_key.cmd");
Run Code Online (Sandbox Code Playgroud)

我的问题:如果我尝试安装我的程序就会中断.使用此代码我只能放弃一个属性,但我需要提交多个.

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

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

我希望你明白我的问题是什么,你可以尝试帮助我.

installer custom-action wix wix-extension wix3.6

8
推荐指数
1
解决办法
6254
查看次数

标签 统计

custom-action ×1

installer ×1

wix ×1

wix-extension ×1

wix3.6 ×1