1

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?

teenup
  • 7,459
  • 13
  • 63
  • 122

1 Answers1

1

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

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Can you help me with getting the properties inside custom action? I tried session["SourceDir"], session.GetSourceDir("") with no success. I read somewhere properties are not available in deferred action. What's the way to get Source Directory and Target Directory? – teenup Jul 31 '13 at 17:01
  • Google "dtf customactiondata" Also read: http://blog.iswix.com/2011/10/beam-me-up-using-json-to-serialize.html – Christopher Painter Jul 31 '13 at 17:03
  • Can you please help me with this question: http://stackoverflow.com/questions/17988392/unable-to-fetch-the-install-location-property-in-a-deferred-custom-action – teenup Aug 01 '13 at 10:26