0

I have a data driven custom action and I'm defining it in its own file along with the table data. When I run my install, it fails because the custom table is missing (I've checked with Orca, its not there).

I realize that the fragment needs to be referenced somehow, and I've noted the advice in questions 10339055 and 6344608.

Following the advice in 6344608, I moved my custom action definition to the same fragment as the table data, like so:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <?include $(sys.CURRENTDIR)\Config.wxi?>

  <Fragment>
    <CustomTable Id="AscomDeviceProfiles">
      <Column Id="ProgId" Type="string" PrimaryKey="yes" Category="Text" />
      <Column Id="ChooserName" Type="string" />

      <Row>
        <Data Column="ProgId">ASCOM.Driver.Type</Data>
        <Data Column="ChooserName">$(var.InstallName)</Data>
      </Row>

    </CustomTable>

    <!-- Define the custom actions that will process the above table data -->
    <Binary Id="binRegAscomDeviceProfiles" SourceFile="$(var.Wix.RegisterAscomDeviceProfiles.TargetDir)\$(var.Wix.RegisterAscomDeviceProfiles.TargetName).CA.dll" />
    <!-- Register and check the return code - must run as "immediate" in order to access session data -->
    <CustomAction Id="caRegisterAscomDeviceProfiles" BinaryKey="binRegAscomDeviceProfiles" DllEntry="RegisterAscomDeviceProfiles" Execute="immediate" Return="check" />
    <!-- Unregister and ignore return code (allows uninstall to succeed even if ASCOM is broken) -->
    <CustomAction Id="caUnregisterAscomDeviceProfiles" BinaryKey="binRegAscomDeviceProfiles" DllEntry="UnregisterAscomDeviceProfiles" Execute="immediate" Return="ignore" />

  </Fragment>
</Wix>

In my Product.wxs file, I reference the custom action by scheduling it, like so:

<InstallExecuteSequence>
  <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWERPRODUCTFOUND AND NOT Installed</Custom>
  <RemoveExistingProducts Before='InstallInitialize' />
  <!-- Elevate to admin if required -->
  <Custom Action='IsPrivileged' Before='LaunchConditions'>Not Privileged</Custom>
  <!-- Create ASCOM device profiles during install finalize phase, but not if already installed -->
  <Custom Action="caRegisterAscomDeviceProfiles" Before="InstallFinalize">NOT Installed</Custom>
  <!-- Remove ASCOM device profiles during uninstall (but not maintenance mode) -->
  <Custom Action="caUnregisterAscomDeviceProfiles" Before="RemoveFiles">REMOVE ~= "ALL"</Custom>
</InstallExecuteSequence>

This pulls in the custom actions correctly and the binaries are created in the output MSI file, as are the InstallExecuteSequence entries: enter image description here enter image description here

But the custom table is nowhere to be seen. I'm sure I'm missing something obvious, but I can't see what it is. Can you?

Community
  • 1
  • 1
Tim Long
  • 13,508
  • 19
  • 79
  • 147
  • Add `EnsureTable` element for your custom table: http://stackoverflow.com/questions/461907/trying-to-use-ensuretable-in-wix-to-fix-validation-errors – Yan Sklyarenko Jul 29 '13 at 11:19
  • According to Rob Mensching's answer to one of the linked questions, that shouldn't be necessary (the table is definitely not empty as you can see from the source, above). However, I think I may be having a build issue that is causing the output not to be updated, so it may be that I'm just looking at old output. I'll post an update when I know more. – Tim Long Jul 29 '13 at 11:43
  • Oops, seems I was commenting before thoroughly reading the text... Sorry about that. – Yan Sklyarenko Jul 29 '13 at 11:48

1 Answers1

1

I found the problem. There is nothing at all wrong with the Wix source, there was a build issue that was preventing the output from being rebuilt correctly.

I suppose the thing to do would be to delete the question since it was really a red herring. I'm not sure whether to delete it or not, so I'll leave it up to the community. I have no objections if anyone wants to vote to delete it.

Tim Long
  • 13,508
  • 19
  • 79
  • 147
  • Just one suggestion. You might want to consider creating an additional column called Component_ and use the MsiEvaluateCondition function inside your custom action rather then putting conditions like Not Installed / REMOVE~="ALL" in your sequence table. This is how the Windows Installer standard actions work. – Christopher Painter Jul 29 '13 at 12:24