How to include fragments in Wix?

后端 未结 2 1810
无人共我
无人共我 2021-01-04 04:46

I have created a wixlib to share fragments in some wix projects.
I can reference fragments which have Property in my main wix file with a PropertyRef, but how can I refe

2条回答
  •  渐次进展
    2021-01-04 05:09

    That's an interesting question! The tutorial says that anything that can be delegated into a fragment has its variant tag: FeatureRef for Feature, PropertyRef for Property, etc. However, the contents of the fragment in your question doesn't issue any errors and the project builds fine.

    I don't know whether it is intentional of not, the Fragment element itself doesn't have a ref brother FragmentRef. For some reason the Fragment element has an optional Id attribute, but it is indicated to be set by advanced users to tag sections. I don't know what it means...

    But, it seems you can cheat here. :-) Add a fake ComponentGroup element to your Fragment, which doesn't contain any real Components:

      
        
        
          
        
        
      
    

    Now, you can reference that ComponentGroup in your main Product.wxs, and the contents of the entire Fragment will be included as promised by the manual:

       
          
          
       
    

    As long as ComponentGroup doesn't has any meaning to the MSI itself, it doesn't bring garbage to the MSI package. But it pollutes the source code, of course...

提交回复
热议问题