Preprocessor extensions
You can create your own variable prefixes (remember var, env, and sys?) and even call C# methods at compile time by writing a preprocessor extension. You'll need to make a new C# class library. We'll walk through each step and then look at the complete code afterwards.
Understand that a preprocessor extension is only executed during compilation to insert data into your WiX markup. So, the end user of your installer will never see it. Also, a preprocessor extension is different than extensions such as WixUIExtension, which are technically compiler extensions. We'll get to make a compiler extension later in the book.
First, in your new class library, add a reference to Wix.dll from the WiX bin directory, and add a using statement ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access