Adding a dll custom action to install shield limited edition project through a merge module created via wix

StackOverflow https://stackoverflow.com/questions/17972652

Question

I have created this wix merge module project and added a dll custom action to it:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Module Id="MergeModule1" Language="1033" Version="1.0.0.0">
    <Package Id="cffa568e-1bf0-4eb3-bee3-eb5801a0bbd0" Manufacturer="Microsoft" InstallerVersion="200" />

    <Binary Id="myCustomActionsDLL" SourceFile="CustomAction1.CA.dll" />

    <CustomAction
    Id="CA_myCustomAction"
    BinaryKey="myCustomActionsDLL"
    DllEntry="CustomAction1"
    Execute="deferred"
    Return="asyncWait" />

    <InstallExecuteSequence>
      <Custom Action="CA_myCustomAction" Before="InstallFinalize" />
    </InstallExecuteSequence>

  </Module>
</Wix>

In my InstallShield Limited Edition setup project, I click on Redistributables and then browse to the MergeModule1.msm file and add it.

When I run the MSI created, it installs successfully, but it seems the custom action is not run, because I don't see a file c:\test.txt:

[CustomAction]
        public static ActionResult CustomAction1(Session session)
        {
            File.WriteAllText(@"c:\test.txt", session.GetTargetPath("") + "-----" + session.GetSourcePath(""));

            return ActionResult.Failure;
        }

When I open the MSI file created in ORCA, I can see that the Custom Action is there in the InstallExecuteSequence table.

What can be the reason that it is not getting executed?

Was it helpful?

Solution

Your troubleshooting should begin by capturing a verbose log and then reading it for errors.

msiexec /I foo.msi /l*v install.log

I'm guessing if you add the Impersonate="no" attribute and change the Return attribte to "check" you'll get a better results.

I use WiX merge modules with InstallShield Limited Edition all the time. I recommend reading the following:

Installation Phases and In-Script Execution Options for Custom Actions in Windows Installer

Installation Collaboration Workflows using Free Tools

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top