• Stars
    star
    1,110
  • Rank 41,831 (Top 0.9 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 9 years ago
  • Updated 24 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

stand with Ukraine

Build status NuGet version (WixSharp) Donate

paypal

Wix# (WixSharp) - managed interface for WiX

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

In July 2014 Wix# was migrated to CodePlex Wix# and re-released under MIT license. It was subsequently migrated from CodePlex to GitHub. You can still find old releases and some useful content from the past discussions on CodePlex.

Project Description

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.

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

Overview

If you are planing to use Wix# on Linux you may find this article being useful. Please note that Wix# builds MSI deployment packages and while MSI can be build on Linux it cannot be run on Linux as MSI is a pure Windows technology.

Please note that WixSharp NuGet packages are targeting .NET Framework only. This is due to the fact that WiX does not support integration with any other .NET flavours but .NET Framework only.

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.

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

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(CustomActions.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: image

The package in the Releases section contains an extensive 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 (Deferred actions)
  • 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

More Repositories

1

cs-script

C# scripting platform
C#
1,620
star
2

cs-script.npp

CS-Script (C# Intellisense) plugin for Notepad++ (x86/x64)
C#
247
star
3

shell-x

Dynamic context menu manager for Windows.
C#
144
star
4

cs-script.core

.NET Core port of CS-Script
C#
100
star
5

codemap.vscode

Code map (syntax tree) of the active document
TypeScript
85
star
6

sublime-codemap

CodeMap - is a ST3 plugin for showing the code tree representing the code structure of the active view/document
Python
41
star
7

cs-script.vscode

VSCode extension for CS-Script
TypeScript
40
star
8

cs-script.net-framework

A mirror of the oleg-shilo/cs-script repository of CS-Script for .NET Framework. A copy of the repo before the product migration on .NET 5migrat
C#
30
star
9

Favorites.vscode

VSCode extension for managing Favorites
TypeScript
23
star
10

PyMap.VSIX

CodeMap extension for Visual Studio 2017-2022
C#
18
star
11

CodeMaidPlus

A simple extension that attempts to address some shortcomings of rather excellent CodeMaid.
C#
16
star
12

DocPreview.VSIX

C#
14
star
13

scripts.npp

C#
13
star
14

sublime-favorites

Favorites list for Sublime Text 3
Python
13
star
15

MoveTypeToFile.VSIX

"Move Type To File" Visual Studio 2017/2019 extension
HTML
10
star
16

multiclip

MultiClip
C#
10
star
17

Retired-VSIX

Repository of legacy Visual Studio extensions
10
star
18

cs-script-sublime

Sublime Text 3 plugin for CS-Script
Python
9
star
19

win-sudo

C#
8
star
20

GC-Menu

C#
7
star
21

LineMan.VSIX

Line manipulation extension for Visual Studio 2017
C#
6
star
22

CS-Script.VSIX

C#
5
star
23

StartApp

Instant launcher for heavy UI applications
C#
3
star
24

PropMan.VSIX

Property Manipulation Utilities for encapsulating fields, converting auto-properties to full properties and back.
C#
3
star
25

syntaxer.core

C#
3
star
26

mkshim

C#
3
star
27

syntaxer

C#
2
star
28

TailRecursion

C#
1
star
29

cs-script.sublime.dev

Python
1
star
30

CodeSnippets

C#
1
star
31

Stack-Analyser

A playground for dealing with call stack and assembly metadata
C#
1
star
32

ruta

C#
1
star
33

vscode-issue-reporting

TypeScript
1
star
34

CopyRefs.VSIX

C#
1
star
35

AsyncIt

C# code-generator analyzer for building Async/Sync API
C#
1
star