How to add preprocessor tags?

Nov 16, 2015 at 11:55 AM
Hi, how can I added preprocessor directives? eg: <?include Constants.wxi ?>

(Not sure if this is feasible via XElement either)
Nov 16, 2015 at 12:57 PM
Adding an XProcessingInstruction is a potential solution:
    static void project_WixSourceGenerated(XDocument document)
        var proc2 = new XProcessingInstruction("define", "ProductVersion=\"!(bind.FileVersion.fil7212AA8A8B46015A04DEF2311F206827)\"");
Nov 16, 2015 at 10:59 PM
You can use WixSharp.Entity extension method AddXmlInclude:
Have a look at InjectXML sample.
Note that the placement of the include is controlled by the nature of the Entity the include is attached to. Thus
new File("Source="Files\Docs\Manual.txt").AddXmlInclude("FileCommonProperies.wxi")
Will produce the following wxs code:
<File Id="Manual.txt" Source="Files\Docs\Manual.txt">
   <?include CommonProperies.wxi?>