You can create your own variable prefixes (remember
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 ...