我有一个问题,关于WiX安装程序和延迟/立即自定义操作的联系。请原谅我的英语。
我想将用户输入的一些属性传递给延迟自定义操作。我知道我需要一个立即自定义操作和“CustomActionData”来实现这一点。我已经按照以下方式实现了它:
二进制文件:
<Binary Id='myAction' SourceFile='.\TemplateGeneration.CA.dll'/>
直接自定义操作:
<CustomAction Id='Datenuebergabe' Property='DoSomething' Value='InstalllocVar=[INSTALLLOCATION]'/>
延迟自定义操作:
<CustomAction Id='TemplateGenerationInstallKey' BinaryKey ='myAction' DllEntry='DoSomething' Impersonate='no' Execute='deferred' Return='check' HideTarget='yes'/>
安装执行序列(InstallExecuteSequence)
<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");
我的问题: 如果我尝试安装我的程序,它就会崩溃。 使用这段代码,我只能提交一个属性,但我需要提交多个。
有关信息: 当我查看日志文件时,在自定义操作调用期间出现了System.Collections.Generic.KeyNotFoundException。
为什么不起作用? 嗯,我需要延迟自定义操作来写入“程序文件夹”。由于需要权限,所以需要延迟自定义操作,并且在延迟之前执行的立即自定义操作应该有助于处理属性。这是否可能?
我希望你理解我的问题,并可能尝试帮助我。