WiX: pulling in a CustomTable from a Fragment WITH

2019-07-21 07:56发布

问题:

I have a custom table defined in a <Fragment> that I want to link into the main .wxs file. My question is similar to this question, but my fragment does not have a <CustomAction> tag to refer to, and there is no <CustomTableRef> tag to use in the main file.

Is the only way to pull in a <Fragment> that does not have a <...Ref>able tag to inject a dummy tag that can be Ref'd? -- e.g. a <Component> with a "never-install" condition, or a <CustomAction> that never gets scheduled to run (or does something totally benign like setting property Foo to "")?

I am looking for a recommended best practice. Thanks!

回答1:

In your fragment you can create a property like so:

<Property Id="IncludeMyFragment" Value="1" />

Then reference that fragment in your source like so:

<PropertyRef Id="IncludeMyFragment"/>

That should pull in the contents of the fragment.



回答2:

When using references, the entire fragment is consumed. Are you defining a custom table simply to be documentation / metadata regarding the MSI or are you actually using it in a data driven custom action? Typically I would define the custom action and custom table schema in a single fragment so that when someone references the custom action they get the supporting infrastructure. Other fragments can then contain the actual data for said custom table ( implementation specific ).



标签: wix fragment