In July 2014 Wix# was migrated here on CodePlex and re-released under MIT license.
At the time of creating this repository CS-Script has been downloaded 23,236 times.


Project Description

Framework for building a complete MSI or WiX source code by using script files written with the C# syntax.

Wix# (WixSharp) is a member in the CS-Script family. Wix# allows building a complete MSI or WiX source code by executing script files written with the plain C# syntax. Wix# engine uses a C# class structure to mimic WiX entities and their relationships in order to produce a valid deployment model.

Wix# answers many MSI authoring challenges. It solves the common MSI/WiX authoring limitations in a very elegant and yet unorthodox way. Wix# follows the steps of other transcompilers like Script#, CoffeeScript or GWT by using source code of a more manageable syntax (C# in this case) to produce the desired source code of a less manageable syntax (WiX). A "more manageable syntax" in this context means less verbose and more readable code, better compile-time error checking and availability of more advanced tools.

Also Wix# removes necessity to develop MSI sub-modules (Custom Actions) in the completely different language (e.g. C++) by allowing both the components and behavior to be defined in the same language (C#). This also allows homogeneous, simplified and more consistent source code structure.


Roadmap

Up to the v0.1.43 WixSharp was publicly available under proprietary permissive licence. Starting from July 2014 WixSharp is available under MIT licence and moved here on CodePlex.

The following features are still under development:

  • Notepad++ support (C# syntax highlight, compiling, wizards etc.) - mostly done
  • Assorted defect fixes

Overview

You can find the instructions on how to author MSI setups with WixSharp in the Documentation section. And this section only highlights some of the available features.

Note: You can use Visual Studio console application project and NuGet package as the starting point. 
          

Alternatively you can install "WixSharp Project Templates" Visual Studio extension. Read more about the Wix# VS templates here.

Wix# allows very simple and expressive deployment definition. This is an example of a simple Wix# script:

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 File(@"Files\Docs\Manual.txt"),
                              new File(@"Files\Bin\MyApp.exe")));
 
        project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");
 
        Compiler.BuildMsi(project);
    }
}

One of the most intriguing features of Wix# is the ability to define/implement managed Custom Actions directly in the script file:

using System;
using System.Windows.Forms;
using WixSharp;
using Microsoft.Deployment.WindowsInstaller;
 
class Script
{
    static public void Main(string[] args)
    {
        var project = new Project("CustomActionTest",
                          new Dir(@"%ProgramFiles%\My Company\My Product",
                              new DirFiles(@"Release\Bin\*.*")),
                          new ManagedAction("MyAction"));
 
        BuildMsi(project);
    }
}
 
public class CustomActions
{
    [CustomAction]
    public static ActionResult MyAction(Session session)
    {
        MessageBox.Show("Hello World!""Embedded Managed CA");
        session.Log("Begin MyAction Hello World");
 
        return ActionResult.Success;
    }
}

 

Another important feature is the support for custom UI including WPF external UI:

The package in the Downloads section contains an intensive collection of Wix# samples covering the following development scenarios:

  •     Visual Studio integration including NuGet packages and VS2013/2015 project templates extension
  •     Installing file(s) into Program Files directory
  •     Changing installation directory
  •     Installing shortcuts to installed files
  •     Conditional installations
  •     Installing Windows service
  •     Installing IIS Web site
  •     Modifying app config file as a post-install action
  •     Installing "Uninstall Product" shortcut into "Program Menu" directory
  •     Installing registry key
  •     Showing custom licence file during the installation
  •     Launching installed application after/during the installation with Custom Action
  •     Executing VBScript Custom Action
  •     Executing Managed (C#) Custom Action
  •     Executing conditional actions
  •     Targeting x64 OSs  
  •     Registering assembly in GAC
  •     File Type registration
  •     Setting/Reading MSI properties during the installation
  •     Run setup with no/minimal/full UI
  •     Localization
  •     Major Upgrade deployment
  •     Authoring and using MergeModules
  •     Pre-install registry search
  •     Customization of setup dialogs images
  •     Rebooting OS after the installation
  •     Building MSI with and without Visual Studio
  •     Simplified Managed bootstrapper for UI based deployments
  •     Simple Native bootstrapper
  •     Custom MSI dialogs
  •     Custom WinForms dialogs
  •     Custom external UI
    • Console setup application
    • WinForm setup application
    • WPF setup application

Last edited Jul 29 at 2:45 AM by oleg_s, version 42