Search code examples
wixcustom-action

Custom action is not running


I've got a custom action I've defined for my installer. The installer doesn't seem to be running.

Here's the lines in the WXS file that define the custom action:

    <CustomAction Id="GetConfigProperties" BinaryKey="GetPropertiesDLL" DllEntry="GetPropertiesFromConfigFile" />

    <InstallExecuteSequence>
        <RemoveExistingProducts After="InstallInitialize" />
        <Custom Action="NewerVersionDetected" After="FindRelatedProducts">NEWERVERSIONDETECTED</Custom>
        <Custom Action="GetConfigProperties" After="FindRelatedProducts"></Custom>
        . . .            
    </InstallExecuteSequence>

    <Binary Id="GetPropertiesDLL" SourceFile="$(var.LPRCore Installer CBP Helper.TargetDir)\LPRCore Installer CBP Helper.CA.dll" />

I've checked the MSI with Orca and the appropriate entries are in the MSI's tables.

Here's an excerpt of the code in the CustomActions.cs file:

    [CustomAction]
    public static ActionResult GetPropertiesFromConfigFile(Session session) {
        // Output a start message to the install log
        session.Log( "Begin GetPropertiesFromConfigFile" );

        . . .


        return ActionResult.Success;
    }

There are a few other session.Log statements in the code at places where I wanted to see what was going on.

Now, I have logging enabled. When I look at the log file in Notepad, I see no messages from my calls to session.Log. I see no references to GetConfigProperties either. It appears that the custom action is not executing at all. What have I done wrong?


Solution

  • It turns out that the custom action wasn't running because:

    1. It was scheduled to run in the wrong place. My fault, I needed to put it in the InstallUISequence section, not the InstallSequence section.

    2. I was aborting the install before the action could run.

    When I put the custom action into the InstallUISequence section and in the right place, everything ran fine.

    Thanks for trying.

    Tony