Question

How do I get Wix to include a CustomTable with no rows in the final MSI? If I simply define the table like this

<CustomTable Id="MyTable">
  <Column Id="Id" Type="string" Category="Identifier" PrimaryKey="yes"/>
  <Column Id="Root" Type="string"/>
  <Column Id="Key" Type="string"/>
  <Column Id="Name" Type="string"/>
</CustomTable>

Wix omits it from the final output.

My DTF CustomAction is expecting it to be there, so that it can add rows to it during execution.

Any ideas?

Was it helpful?

Solution

Thanks to a comment in this blog post (which, by the way, has a very useful example of a DTF Custom Action) I found the Wix EnsureTable element, which makes sure a table appears in the output, even if it is empty.

So to make my example work, I need to do this:

<CustomTable Id="MyTable">
  <Column Id="Id" Type="string" Category="Identifier" PrimaryKey="yes"/>
  <Column Id="Root" Type="string"/>
  <Column Id="Key" Type="string"/>
  <Column Id="Name" Type="string"/>
</CustomTable>

<EnsureTable Id="MyTable"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top