【发布时间】:2015-01-30 08:04:24
【问题描述】:
我对托管代码自定义操作有一些问题。我有 3 个自定义操作,但只有一个在工作。它们在 InstallExecuteSequence 中的不同时间被调用,但移动它们没有区别。我知道那里不会走得太远,因为如果我在例程的开头放置一个消息框(用于调试),它永远不会被调用。我哪里错了?操作是这样创建的。
<Binary Id="CA" SourceFile="$(var.ca.Custom.Actions.TargetDir)$(var.ca.Custom.Actions.TargetName).CA.dll" />
<CustomAction Id="WriteRemoveArpEntry" Property="CustomActionData" Value="PNAME=$(var.ProductName)" HideTarget="yes" />
<CustomAction Id="RemoveArpEntry" BinaryKey="CA" DllEntry="RemoveProductFromARP" Return="ignore" />
<CustomAction Id="SetValueforProductFolder" Property="CustomActionData" Value="SDIR=[INSTALLDIR];TDIR=[MANUDIR]\backup\$(var.ProductName)\$(var.VersionNumber)" HideTarget="yes" />
<CustomAction Id="Backup_Product_DIR" BinaryKey="CA" DllEntry="BackupDIR" Return="ignore" />
<CustomAction Id="WriteInstallAttemptData" Property="CustomActionData" Value="PRODUCTNAME=$(var.ProductName);APPVERSION=$(var.VersionNumber)" HideTarget="yes" />
<CustomAction Id="WriteInstallAttempt" BinaryKey="CA" DllEntry="WriteXMLServer" Return="ignore" />
然后我给他们打电话
<Custom Action="SetValueforProductFolder" Before="Backup_Product_DIR">NOT Installed AND NOT REMOVE</Custom>
<Custom Action="Backup_Product_DIR" Before="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
<Custom Action="WriteRemoveArpEntry" Before="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
<Custom Action="RemoveArpEntry" After="WriteRemoveArpEntry">NOT Installed AND NOT REMOVE</Custom>
<Custom Action="WriteInstallAttemptData" After="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
<Custom Action="WriteInstallAttempt" After="WriteInstallAttemptData">NOT Installed AND NOT REMOVE</Custom>
</InstallExecuteSequence>
例程的标题如下所示
public static ActionResult BackupDIR(Session session)
{
public static ActionResult RemoveProductFromARP(Session session)
{
Public static ActionResult WriteXMLServer(Session session)
{
但是只有 WriteXMLServer 有效。在日志文件中,我得到以下内容。
MSI (s) (BC:9C) [07:23:45:562]:调用远程自定义操作。动态链接库: C:\Windows\Installer\MSI2E2A.tmp,入口点:BackupDIR CustomAction Backup_Product_DIR 返回实际错误代码 1154 但将 由于继续标记而转化为成功
在我得到的工作中
MSI (s) (BC:A0) [07:24:25:994]:调用远程自定义操作。动态链接库: C:\Windows\Installer\MSICC20.tmp,入口点:WriteXMLServer SFXCA: 将自定义操作提取到临时目录: C:\Windows\Installer\MSICC20.tmp-\ SFXCA:绑定到 CLR 版本 v4.0.30319
【问题讨论】:
标签: wix custom-action wix3.6