Wix# (WixSharp) – managed interface for WiX
By Oleg Shilo
This article describes Wix# (WixSharp), a managed interface to WiX (Windows Installer XML toolset for building Windows installation packages from the XML source code). Wix# allows building a complete MSI or WiX source code by using script files written with the C# syntax. It uses a C# class structure to mimic WiX entities and their relationships in order to produce a valid deployment model.
Diagrams showing MSI Deployment with Visual Studio and directly with WiX
The Wix# concept is quite simple. The Wix# source file is an ordinary C# file containing code defining relationships between instances of Wix# classes. Wix# classes represent deployment entities: files, shortcuts, registry values etc. The Wix# source file can be translated by the Wix# engine into the WiX source file, which then (optionally) can be automatically compiled into MSI.
Script for installing MyApp.exe into <ProgramFiles>\My Company\My Product directory; showing a custom license file; creating shortcuts to Install/Uninstall the product and to launch MyApp.exe from <Desktop> and <ProgramMenu>:
static public void Main(string args)
var project = new WProject(“MyProduct”,
new WDir(@”%ProgramFiles%\My Company\My Product”,
new WShortcut(@”%ProgramMenu%\My Company\My Product”),
new WShortcut(“Uninstall MyApp”, “[System64Folder]msiexec.exe”, “/x [ProductCode]”)),
new WDir(@”%ProgramMenu%\My Company\My Product”,
new WShortcut(“Uninstall MyApp”, “[System64Folder]msiexec.exe”, “/x [ProductCode]”))));
project.Id = new Guid(“6f330b47-2577-43ad-9095-1861ba25889b”);
project.LicenceFile = @”AppFiles\License.rtf”;