Craig Reeves
Craig Reeves

Reputation: 56

Custom Actions not been called

I have some problems with managed code custom actions. I have 3 custom actions but only one of them is working. They are called at different times in InstallExecuteSequence but moving them makes no difference. I know there not getting very far because if I place a message box at the beginning of the routine(for debugging) it never get called . Where am I going wrong ? The actions are created like so.

<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" />

I then call them here

  <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>

The headers for the routines look like this

public static ActionResult BackupDIR(Session session)
   {


public static ActionResult RemoveProductFromARP(Session session)
   {

Public static ActionResult WriteXMLServer(Session session)
    {

However only WriteXMLServer works. In the log file I get the following .

MSI (s) (BC:9C) [07:23:45:562]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI2E2A.tmp, Entrypoint: BackupDIR CustomAction Backup_Product_DIR returned actual error code 1154 but will be translated to success due to continue marking

In the one that works I get

MSI (s) (BC:A0) [07:24:25:994]: Invoking remote custom action. DLL: C:\Windows\Installer\MSICC20.tmp, Entrypoint: WriteXMLServer SFXCA: Extracting custom action to temporary directory: C:\Windows\Installer\MSICC20.tmp-\ SFXCA: Binding to CLR version v4.0.30319

Upvotes: 0

Views: 393

Answers (1)

Craig Reeves
Craig Reeves

Reputation: 56

The answer was very simple I forgot the

[CustomAction]

For the other two routines.

Upvotes: 1

Related Questions