【发布时间】:2013-02-14 00:44:18
【问题描述】:
我做错了什么??
如果您的回答是我应该使用内置服务在 WiX 中安装东西,请不要回答。 对我来说效果不太好,我不想将 XSLT 转换应用到我的 HEATed .wxs 文件。
根据我的日志,它正在执行两个自定义操作,但 InstallAndStartServices 告诉我“INSTALLFOLDER”不在 session.CustomActionData 字典中。
<Binary Id="ServiceInstaller" SourceFile="DeploymentItems\ServiceInstaller.CA.dll" />
<CustomAction Id="SetInstallFolderForCA" Property="InstallAndStartServices" Value="INSTALLFOLDER=[INSTALLFOLDER]" Execute="immediate" Return="check" />
<CustomAction Id="InstallAndStartServices" BinaryKey="ServiceInstaller" DllEntry="InstallAndStartServices" Execute="immediate" Return="check" />
<InstallExecuteSequence>
<Custom Action="SetInstallFolderForCA" After="InstallFiles">NOT Installed</Custom>
<Custom Action="InstallAndStartServices" After="SetInstallFolderForCA"/>
</InstallExecuteSequence>
MSI (s) (78:DC) [15:31:47:745]:属性更改:添加 InstallAndStartServices 属性。它的值为 'INSTALLFOLDER=C:\Program Files\My Product\'。
MSI (s) (78:DC) [15:31:47:745]:执行操作:InstallAndStartServices
MSI (s) (78:DC) [15:31:47:745]: 注意: 1: 2205 2: 3: ActionText
动作开始时间 15:31:47:InstallAndStartServices。
开始安装服务
自定义操作引发的异常: System.Reflection.TargetInvocationException:调用的目标已引发异常。 ---> System.Collections.Generic.KeyNotFoundException: 给定的键不在字典中。
在 System.Collections.Generic.Dictionary`2.get_Item(TKey key)
在 Microsoft.Deployment.WindowsInstaller.CustomActionData.get_Item(字符串键)
string installFolder = session.CustomActionData["INSTALLFOLDER"];
【问题讨论】:
-
嗯。原来我不得不在 CA 上推迟执行。谁能解释一下它是如何“延迟”的,以及“立即”和“延迟”之间会发生什么?
-
自定义操作在对系统进行更改时应延迟运行。快速提问..你为什么不使用 WIX 来安装和启动你的服务?
-
我很想向你解释这一切,但你已经说过你不想知道如何以正确的方式做事。
-
“正确的方法”似乎是使用Heat然后滥用它的输出,然后手工重新做一部分。对我来说,这听起来像是“错误的方式”。我没有使用 WiX 来安装和启动服务(总共有五个),因为我必须从 Heat 输出中删除服务可执行文件,然后在 Product.wxs 中单独添加它们。
标签: properties wix custom-action