代码之家  ›  专栏  ›  技术社区  ›  Craig Reeves

未调用自定义操作

  •  0
  • Craig Reeves  · 技术社区  · 10 年前

    我在托管代码自定义操作方面有一些问题。我有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自定义操作 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版本 版本4.0.30319

    1 回复  |  直到 10 年前
        1
  •  1
  •   Craig Reeves    10 年前

    答案很简单,我忘了

    [CustomAction]
    

    对于其他两个例程。