Creating a C# custom action and referencing it in your project

In this recipe, we'll see how to create a C# custom action that does something simple: get the computer's time zone and store it in a WiX property. Often, we need to collect information like this and either present it on the GUI or use it behind the scenes to make some decisions later when the computer is modified.

Windows installer doesn't know how to use a C# custom action directly. It only understands unmanaged code. However, WiX comes with a library called Deployment Tools Foundation (DTF) that bridges the gap. The C# custom action project template that's installed in Visual Studio with the WiX toolset starts out with a reference to the Microsoft.Deployment.WindowsInstaller assembly. ...

Get WiX Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.