Wix# (WixSharp) – managed interface for WiX


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




Wix# Overview

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>:

using System;

class Script
    static public void Main(string[] args)
        var project = new WProject(“MyProduct”,
                          new WDir(@”%ProgramFiles%\My Company\My Product”,
                              new WFile(@”Files\Bin\MyApp.exe”,
                                  new WShortcut(@”%ProgramMenu%\My Company\My Product”),
                                  new WShortcut(@”%Desktop%”)),
                              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”;
       WCompiler.BuildMsi(project); }

Via CodeProject: Wix# (WixSharp) – managed interface for WiX. Free source code and programming help


One thought on “Wix# (WixSharp) – managed interface for WiX

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s