Skip to content
Oleg Shilo edited this page Apr 1, 2024 · 22 revisions

Wix# (WixSharp) managed interface for WiX

The project has been migrated to GitHub from CodePlex: Wix#. Thus some links may still point to CodeProject Wiki articles.

The first publicly available version of Wix# was published in 2009 on CodeProject. The original CodeProject article along with this interview for InfoQ offer the best explanations of the reasons behind Wix#. They describe very well the problems and common deployment challenges that Wix# is trying to solve. They also provides a good overview of the existing deployment authoring solutions and approaches.

Wix# is a framework for building a complete MSI or WiX source code by using script files written with the C# syntax. The simple code snippet below is a typical MSI setup authored with Wix#:

using System;
using WixSharp;
 
class Script
{
    static public void Main(string[] args)
    {
        var project = new Project("MyProduct",
                          new Dir(@"%ProgramFiles%\My Company\My Product",
                              new Dir("Tools",
                                  new Files(@"Tools\*.*"
                              new File(@"Files\Docs\Manual.txt"),
                              new File(@"Files\Bin\MyApp.exe")));
 
        project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");
 
        Compiler.BuildMsi(project);
    }
}

Dependencies

You can build MSI/Burn binaries either with Visual Studio, VSCode or CS-Script (Python like C# scripting engine).

WixSharp uses various msi authoring tools (e.g. compiler, linker) that are part of WiX Toolset. Meaning that you need to install WiX toolset. You have a few options:

  • WiX3
    • Install it from WiX home page or
    • Import it as a WixSharp nuget package (WixSharp.wix.bin) in your project.
  • WiX4
    • Install it as a .NET tool
      dotnet tool install --global wix
      

You will need to use at least one NuGet package WixSharp.bin and have WiX installed (can also be used as a package).

These are the packages that you can use: nuget list wixsharp*

Documentation

The Wix# documentation comes in the following forms:

  • XML code documentation
    XML documentation contains the code samples (embedded in the class summaries) as well as the complete description of all class members. While the code documentation is available in the form of API Reference CHM help file it is not intended to guide the developers through the development but rather assist with the codding.

  • Code samples
    Extensive collection of the code samples (\Samples) from release package. This is the most useful source of information and the best way of learning Wix#. All samples are self-sufficient and cover an extremely wide range of the deployment scenarios. The code samples make a significant part of the total Wix# codebase volume. you can also browse read-only samples directly in GitHub samples folder

  • Wiki

  • Code Contribution Guideline
    A small set of development points to assist developers with contributing to the Wix# project.


Additional/External Documentation: