Question

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?

Was it helpful?

Solution

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.

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