0

I want to create a fragment file that will only contain a CustomTable in the file. This is easy enough, but I do not know how to link/include it back into the main product.wxs file.

The fragment file is in the same project as the product file, and I have also tried adding an include tag for the file without success, and even putting the custom table into a WiX include file.

Is there a way to do this? Or is it going to have to live in the product file?

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
Norm Wirth
  • 55
  • 6

2 Answers2

2

The WiX toolset compiles and links in a similar manner to the C/C++ compiler. The linker starts at the "main" entry point (Product element, in your case) then follows the references from there, which in turn follows references from there until all are resolved.

Part of your question is missing but based on the title I'm going to guess that you want a CustomTable element. Typically that CustomTable is processed by a CustomAction. There are a couple good ways to reference a CustomAction.

I would not use an include file.

Rob Mensching
  • 33,834
  • 5
  • 90
  • 130
  • Ahh, I did not notice it removed what tag I wanted in the separate file. I have tried, as you suggested, just putting the CustomTable in a separate fragment file, complete with data, and it does not appear to be in the database when viewing the MSI with ORCA. What kind of reference should I use to reference the custom table in a separate fragment file? – Norm Wirth Jun 15 '11 at 11:56
  • You just need one reference to something in the `Fragment`. I recommended putting your `CustomAction` definition in the same `Fragment` with the `CustomTable` so you can schedule the `CustomAction` and have the whole `Fragment` pulled in. – Rob Mensching Jun 30 '11 at 04:52
  • Now I understand how to implement this. Thanks, Rob, for the help and understanding. – Norm Wirth Jul 06 '11 at 13:16
0

You could try using EnsureTable if you'd like to make sure the table is created whether or not there is data in it. If you'd like to separate the custom table's schema definition from the data I believe you can just define them in separate fragments and reference the schema definition from the data definition fragment by opening with <CustomTable Id="your table name"> and defining the rows of data within it.

In general Wix won't pull fragments into the main authoring unless they contain elements that are referred to somewhere and since there is currently no such thing as CustomTableRef you may opt to use other elements such as an empty PayloadGroup or ComponentGroup that you can refer to (using a PayloadGroupRef or ComponentGroupRef respectively) from your main Bundle, Product or Module element as the case may be.

Jimit
  • 765
  • 2
  • 10
  • 18