-
Book Overview & Buying
-
Table Of Contents
WiX 3.6: A Developer's Guide to Windows Installer XML
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 for Microsoft.Tools.WindowsInstallerXml. Next, add a class that extends the WixExtension class. Here, we've called it MyWixExtension:
using Microsoft.Tools.WindowsInstallerXml;
namespace MyPreprocessorExtension
{
public class MyWixExtension...