Introduction

Winstaller is a next-generation setup creator and package manager client for Windows, designed to replace old, complex installation builders like Inno Setup or Wix Toolset. It focuses on modern standards, speed, and simplicity.

It is completely free for non-commercial projects, making it ideal for open-source developers, students, and hobbyists. For commercial projects, a valid license is required.

Installation

Winstaller is available via the Windows Package Manager (<code>winget install winstaller</code>), Microsoft Store, or as a portable ZIP package from our Portal. When using the ZIP package, extract the archive to a directory of your choice and add the path to your system's Environment Variables (PATH).

You can download the latest version from the Portal after creating a free account and logging in.

Quickstart

To get started, create a simple configuration file (e.g. `config.json`) describing your application's installer. Below is a minimal example:

{
  "productCode": "my-test-success-application",
  "name": "MyTestSuccessApplication",
  "installation": {
    "type": "local",
    "dir": "MyTestSuccessApplication"
  },
  "publisher": "Test Success Publisher",
  "icon": "winstaller.ico",
  "version": "1.2.3",
  "shortcut": {
    "desktop": {
      "destination": "%installation%\\app.exe",
      "name": "MyTestSuccessApplication"
    }
  },
  "install": [
    { "type": "welcome"},
    { "type": "license" },
    { "type": "installtype" },
    { "type": "install" },
    { "type": "success"}
  ],
  "uninstall": [
    { "type": "confirmuninstall" },
    { "type": "uninstall" }
  ],
  "content": [
    {
      "type": "dir",
      "source": "data",
      "destination": "%installation%"
    }
  ]
}

Then run the winstaller CLI tool, passing the path to your configuration file to build the installer:

winstaller config.json

CLI & Command Line Flags

Winstaller provides a command-line interface tool for build automation as well as runtime flags for generated installer executables.

1. CLI Compiler (winstaller)

The CLI build tool is used to compile setup packages from the command line or CI/CD pipelines.

Command Syntax

winstaller <config.json> [output-directory] [-target=<windows|console|both>] [-min-logs=<level>]
Field Required Default Description
config.json Yes - Path to the installer JSON configuration file.
output-directory No ./output Target output directory for the compiled setup package.
-target=<windows|console|both> No windows Target template for the installer: windows (WPF GUI), console (terminal CUI), or both (dual-build simultaneously).
-min-logs=<level> No info Minimum log level for the build process (debug, info, warning, error).

2. Generated Installer Switches (Setup.exe)

The generated setup executable (.exe) accepts command-line flags for silent installation and deployment customization.

Execution Syntax

Setup.exe [-silent] [-lang=<code>] [-min-logs=<level>]
Field Type Default Description
-silent Flag false Runs installation or uninstallation in silent headless mode in the background, suppressing GUI windows and terminal prompts (also accepts aliases -y, --yes, -q, --quiet).
-lang=<code> String Auto (OS) Forces the setup UI language (e.g. pl, en, de, es), overriding system OS language settings.
-min-logs=<level> String info Specifies minimum logging severity for log files created in %temp%\winstaller\.

Configuration File (config.json)

The configuration file defines the structure, installation behavior, visual style, and execution steps of the installer and uninstaller. Below is a comprehensive example of the JSON structure:

{
  "productCode": "my-test-application",
  "name": "My Application",
  "version": "1.0.0",
  "target": "windows",
  "installation": {
    "type": "system",
    "dir": "MyApplication"
  },
  "publisher": "Test Publisher",
  "icon": "app.ico",
  "runAsAdmin": true,
  "register": true,
  
  "shortcut": {
    "desktop": {
      "destination": "%installation%\\app.exe",
      "name": "My Application"
    },
    "menu": {
      "destination": "%installation%\\app.exe",
      "name": "My Application"
    }
  },
  "appearance": {
    "showNavigation": true,
    "width": 760,
    "height": 520
  },
  "resources": {
    "license": "licenses/license.rtf",
    "license_pl": "licenses/license_pl.rtf"
  },
  
  "install": [
    { "type": "welcome"},
    { "type": "license" },
    { "type": "installtype" },
    { "type": "install" },
    { "type": "success"}
  ],
  "uninstall": [
    { "type": "welcome" },
    { "type": "uninstall" },
    { "type": "success" }
  ],
  
  "content": [
    {
      "type": "file",
      "source": "app.exe",
      "destination": "%installation%\\app.exe"
    },
    {
      "type": "dir",
      "source": "assets",
      "destination": "%installation%\\assets"
    }
  ],
  
  "update": {
    "preserve": [
      "logs",
      "appsettings.json",
      "data"
    ]
  }
}

Root Properties

The root JSON object supports the following properties:

Field Type Required Default Description
productCodeStringYes-Unique product identifier, used as the registry key name for the uninstaller.
nameStringYes-Display name of the application.
versionStringYes-Application version conforming to Semantic Versioning (e.g. 1.0.0, 1.2.3-beta.1, 1.2.3-4).
publisherStringYes-Publisher or manufacturer name.
copyrightStringNoAutoCopyright information in file metadata.
commentsStringNo-Additional comments in file metadata.
descriptionStringNo-File description in metadata.
targetStringNo"windows"Installer target environment: "windows" (WPF GUI), "console" (terminal CUI), or "both" (generates both GUI and console binaries).
installationObjectNo-Target installation folder configuration (type and dir).
iconStringNo-Path to the installer and shortcuts icon (.ico).
runAsAdminBooleanNofalseDetermines if the installer prompts for UAC elevation.
registerBooleanNotrueRegisters application in Windows Uninstall Registry for Control Panel.
envPathStringNo-Appends specified path to the system/user PATH environment variable.
shortcutObjectNo-Desktop and Start Menu shortcut configurations.
appearanceObjectNo{ ... }Installer UI window layout, window dimensions, and navigation sidebar configuration.
resourcesObjectNo-External resource paths, such as RTF/TXT license documents (license, license_pl, license_en, etc.).
installArrayYes-Sequence of setup wizard steps (Welcome, License, Install, etc.).
uninstallArrayYes-Sequence of uninstaller steps.
contentArrayNo-Files and directories to package and extract.
serviceObjectNo-Windows Service installation and control configuration.
signingObjectNo-Code signing certificate and timestamp server configuration.
pluginsArrayNo-Array of external .NET plugin DLLs to load custom steps.
scriptsObjectNo-Pre-install and post-install C# background scripts.
translationsObjectNo-Custom language dictionaries to localize setup strings.
allowedLanguagesArrayNo-Array of allowed UI languages (defaults to all supported).
updateObjectNo-Configuration of update behavior (preserving user files, config, databases, etc.).

Application Version and Semantic Versioning (version field)

The version field is validated according to the Semantic Versioning (SemVer) specification. The version must consist of three primary numeric segments: MAJOR.MINOR.PATCH (e.g. 1.0.0), optionally with pre-release tags (e.g. 1.2.3-beta.1) or build metadata following a plus sign (e.g. 1.0.0+build.2026). An optional v prefix is also accepted (e.g. v1.2.3).

"version": "1.2.3"

Examples of valid version strings: 1.0.0, 2.1.0-rc.1, 0.9.5-alpha+sha.5114f85.

Tip for 4-segment versions: The SemVer standard does not allow traditional 4-segment version numbers such as 1.2.3.4 (they will be rejected by validation). If your project requires 4 version segments (e.g. a build or revision number), you can easily work around this by placing the fourth segment after a hyphen/minus sign - — for example, 1.2.3-4 instead of 1.2.3.4. This way, version precedence is preserved (e.g. version 1.2.3-4 is recognized as older than 1.2.3-5).

Target Environment Selection (target field)

Winstaller supports building both graphical (WPF) and console-based (CUI) installers. The target field determines which executable flavor is produced:

"target": "both"
Value Output File Description
"windows" [AppName].exe Standard graphical installer with WPF UI. Produces [AppName].exe.
"console" [AppName].exe Console installer running in Windows CUI subsystem. Operates in terminal with interactive [Y/n] prompts, dynamic progress bars, and silent mode. Produces [AppName].exe (or .console.exe).
"both" [AppName].exe & [AppName].console.exe Simultaneously generates both installers: [AppName].exe (graphical version) and [AppName].console.exe (console version).

1. Installation Object

The `installation` object specifies the default target path for the application files:

"installation": {
  "type": "local",
  "dir": "MyApplication"
}
Field Type Required Default Description
type String No "local" The installation scope type. Possible values: "system" (installs in Program Files), "local" (installs in the user's directory).
dir String Yes - The target subdirectory name for the application installation.

2. Shortcut Object

Configure shortcuts on the Desktop and/or Start Menu:

"shortcut": {
  "desktop": {
    "name": "Desktop Shortcut",
    "destination": "%installation%\\app.exe"
  },
  "menu": {
    "name": "Start Menu Shortcut",
    "destination": "%installation%\\app.exe"
  }
}

3. Content Array Items

Specify files or folders. Winstaller packages them into an embedded ZIP and extracts them on the client machine:

"content": [
  { "type": "file", "source": "app.exe", "destination": "%installation%\\app.exe" },
  { "type": "dir", "source": "data", "destination": "%installation%\\data" }
]

4. Install & Uninstall Steps

Available built-in step types:

welcome (Welcome screen), installtype (Destination folder select), license (License agreement), confirmuninstall (uninstall confirmation), install (Runs file copying & registry writes), success (Final success screen).

"install": [
  { "type": "welcome" },
  { "type": "license" },
  { "type": "installtype" },
  { "type": "install" },
  { "type": "success" }
]

5. Code Signing Object

Winstaller CLI has built-in code signing support, using standard Cryptui.dll system libraries. No external tools like signtool.exe are required:

"signing": {
  "certificatePath": "winstaller-test.pfx",
  "certificatePassword": "%MY_PFX_PASSWORD%",
  "timestampUrl": "http://timestamp.digicert.com"
}

6. Service Object

Installs and runs the application as a native Windows Service (requires runAsAdmin set to true):

"service": {
  "name": "MyService",
  "start": "auto",
  "runAfterInstallation": true,
  "forceStop": true,
  "path": "%installation%\\myservice.exe"
}
Field Type Required Default Description
name String No - The name of the system service (defaults to application name if omitted).
start String No "auto" The startup type for the service. Possible values: "auto" (starts automatically with the system), "demand" (starts on demand), "disabled" (disabled).
runAfterInstallation Boolean No false Specifies whether the service should start immediately after installation completes.
forceStop Boolean No true Specifies whether to force stop the service before updating or uninstalling.
path String Yes - The path to the service executable (can contain variables like %installation%).

7. Plugins and Scripts

You can extend Winstaller with custom UI steps (implementing IStep) or background scripts (pre/post install implementing IScript) using C# library plugins:

"plugins": [
  "libs/MyCustomPlugins.dll"
],
"scripts": {
  "preInstall": [ "my-custom-pre-install-script" ],
  "postInstall": [ "my-custom-post-install-script" ]
}

8. Appearance Object

Configures the visual layout and UI window options:

"appearance": {
  "showNavigation": true,
  "width": 760,
  "height": 520
}
Field Type Required Default Description
showNavigation Boolean No true Specifies whether to display the navigation sidebar in the main wizard window (setting to false hides the sidebar and expands content).
width Integer No 760 Width of the main installer window in pixels (default is 760).
height Integer No 520 Height of the main installer window in pixels (default is 520).

9. Resources Object & License Configuration (RTF / TXT)

The `resources` object specifies paths to external asset files required by installer steps, primarily License Agreement documents in RTF (Rich Text Format) or plain text format. Below is an example configuration:

"resources": {
  "license": "licenses/license_en.rtf",
  "license_pl": "licenses/license_pl.rtf",
  "license_de": "licenses/license_de.rtf"
},
"install": [
  { "type": "welcome" },
  { "type": "license" },
  { "type": "install" },
  { "type": "success" }
]
Field Type Required Default Description
license String No - Default license document file path (used as fallback when a language-specific key is not found).
license_<lang> String No - Localized license document file path for a specific language code (e.g. `license_pl` for Polish, `license_de` for German).

How License Loading Works

When the `{ "type": "license" }` step is present in the `install` array, Winstaller executes the following logic:

  • Step Activation: Adding { "type": "license" } to the install array enables the License Agreement step in the wizard.
  • Language Matching (i18n): The installer detects the active UI language (from Windows OS or -lang= flag) and searches resources for a matching key (e.g. license_pl). If not found, it falls back to resources.license.
  • RTF & Text Rendering: Content is loaded into a WPF RichText FlowDocument. Full RTF formatting (bold text, colors, headers, lists) is rendered automatically. For plain text files (.txt) or malformed RTF, Winstaller gracefully falls back to UTF-8 text.
  • GUI & Silent Behavior: The Next button remains disabled until the acceptance checkbox is checked. In silent mode (-silent flag), the license step is automatically accepted and bypassed in the background.

10. Update Object (Preserving Files During Updates)

The update section specifies files and directories to preserve from the previous installation when updating an application. The preserve node accepts an array of relative paths or wildcard patterns (e.g. *.db) relative to the installation directory:

"update": {
  "preserve": [
    "logs",
    "appsettings.json",
    "data",
    "*.db"
  ]
}
Field Type Required Default Description
mode String No "swap" Update mode: "swap" (default – safe directory swap with full rollback) or "overwrite" (direct in-place extraction without rollback, tailored for large games and 100GB+ packages).
preserve Array No [] List of file paths, directories, or wildcard patterns (e.g. "logs", "appsettings.json", "*.db") preserved from the previous version.

Handling File Collisions (Overwriting)

When a file specified in preserve exists in both the newly installed package and the existing user installation (e.g. user-customized appsettings.json):

1. Swap mode: The user's file from the previous version has priority and is restored to its original path (appsettings.json), directly overwriting the default file provided in the new package.
2. Overwrite mode: The installer checks if the target file already exists on disk. If so, it does not overwrite it (skips extraction).
3. Runtime-generated files: Files created at runtime (e.g. SQLite databases, logs directory) that are not present in the new package remain intact in both modes.

Pattern Matching Rules (.gitignore / glob standard)

The preserve node follows standard .gitignore pattern matching semantics:

No slash (e.g. *.db, appsettings.json, logs): Matches files or directories at any nesting depth — in the root directory and across all subdirectories.
Leading slash (e.g. /*.db, /logs): Anchors the pattern strictly to the root installation directory (subdirectories are ignored).
Path with middle slash (e.g. data/*.db): Matches files directly in the specified subdirectory.
Double asterisk (e.g. data/**/*.db): Recursively matches files across all subdirectories of the specified directory.
Trailing slash (e.g. logs/): Restricts the pattern to match directories only.

Application Updates & Lifecycle

Winstaller includes a built-in mechanism for safe application updates with two distinct strategies: atomic directory swap (swap) and direct in-place extraction (overwrite). This section explains both update modes, recommended storage locations for dynamic application data, and the preserve configuration that protects databases and user settings from data loss.

1. Two Update Modes: Swap vs Overwrite

Winstaller provides two distinct update strategies configured via update.mode:

Swap Mode (default – "mode": "swap"):
Designed for standard desktop applications and Windows Services. The new version is extracted and staged entirely in an isolated temporary directory (%installation%_temp). Once prepared, an atomic directory rename (Directory Swap) moves the existing installation to %installation%_backup and activates the new version. If any error occurs, an automatic full rollback restores the previous version. Preserved files are moved from backup into the new installation, directly overwriting target files.

Overwrite Mode ("mode": "overwrite"):
Engineered specifically for games and large applications (e.g. 50–100 GB+), where duplicating directory structures into a temp directory and holding a full backup would require excessive disk space. In this mode, files are directly extracted and copied into the installation directory without creating a full backup and without rollback. If an incoming package file matches a rule in preserve and already exists on disk, it is not overwritten (it is skipped). All other files are updated, and existing runtime files (e.g. game saves, local logs) stay intact.

2. Where Should Applications Store State? (Windows Best Practices)

According to Microsoft guidelines and the Windows User Account Control (UAC) security model, the application installation directory (e.g. C:\Program Files\YourApp) should strictly host immutable executables and static assets. Standard users lack write permissions to this directory. Dynamic data generated at runtime must reside in dedicated Windows standard locations:

Location / Variable Description
%APPDATA%
AppData\Roaming
Per-user configurations and preferences that should roam with the user account across domain networks (Active Directory / roaming profile).
%LOCALAPPDATA%
AppData\Local
Machine- and user-specific data: per-user SQLite databases, local caches, session logs, and temporary working files.
%PROGRAMDATA%
C:\ProgramData
Shared state across all local computer users: machine-wide databases, Windows Service logs, common licenses, and shared application state.

3. Warning: Risk of Data Loss in the Installation Folder

Many desktop tools and legacy applications store database files (e.g. app.db), modified user settings (appsettings.json), or log directories directly inside their installation directory (%installation%).

WARNING: Because updates use the Directory Swap pattern, runtime files created inside the installation directory would be permanently lost when the old installation directory is cleaned up! The newly installed directory only contains the fresh files bundled in the new installer package.

4. Solution: The update.preserve Mechanism & .gitignore Patterns

To ensure complete data and configuration safety for such applications, Winstaller provides the update.preserve configuration. Prior to deleting the backup directory, the installer scans previous files and automatically migrates the configured resources into the new installation.

Paths and wildcards in preserve follow standard .gitignore / glob semantics:

No slash (e.g. *.db, appsettings.json, logs): Matches files or directories at any nesting depth — in the root directory and across all subdirectories.
Leading slash (e.g. /*.db, /logs): Anchors the pattern strictly to the root installation directory (subdirectories are ignored).
Middle slash (e.g. data/*.db): Matches files directly in the specified relative path.
Double asterisk (e.g. data/**/*.db): Recursively matches files across all subdirectories of the specified directory.
Trailing slash (e.g. logs/): Restricts matching strictly to directories.

"update": {
  "mode": "swap",
  "preserve": [
    "logs/",
    "appsettings.json",
    "*.db",
    "data/**/*.dat"
  ]
}

5. Handling File Collisions Across Modes

When a file specified in preserve exists in both the user's previous installation and the new package (e.g. appsettings.json):

In swap mode: The user's preserved file from the previous installation has priority and overwrites the new package file. The application launches immediately with existing settings and database state intact.
In overwrite mode: The installer checks whether the file already exists on disk. If so, it does not overwrite it (skips extracting/copying that file), leaving the user's file completely untouched.

Custom UI Steps Architecture & Guide

1. Overview & Role of Winstaller.Interfaces

Winstaller provides a clear separation of concerns between the core setup engine and the user interface. The Winstaller.Interfaces library delivers a complete set of abstractions so you can focus solely on designing custom screens and application logic.

You don't need to write file copying routines, Windows Event Log entries, registry handlers, UAC elevation prompts, window frames, or theme engines. All these core operations are performed by Winstaller engine, which is accessible via the Context property (InstallerContext).

🚀 Working Sample Project:
A complete, compiled, and working project demonstrating custom wizard steps is available on GitHub: https://github.com/winstallerorg/Winstaller.Examples (in directory 02-CustomSteps).

2. Prerequisites

To build custom wizard steps, your project must meet two requirements:

  • Framework Version: C# library project must target .NET Framework 4.7.2 or higher (matching installer runtime environment).
  • Library Reference: Add NuGet package or reference to Winstaller.Interfaces (providing access to IStep, StepViewBase, IView, InstallerContext, and PluginNameAttribute).

3. IStep Architecture & Step Lifecycle

The IStep interface represents a single step in the setup sequence. It separates wizard state management from WPF UI rendering and supports headless silent mode execution.

Method / Property Lifecycle Role Why is it designed this way and how it works
Initialize(StepConfig config) Parameter initialization Invoked right after loading JSON config. Receives StepConfig object containing configuration parameters (custom headers, paths, options).
Start(IView? view) Step activation Invoked when step becomes active. In GUI mode, receives view parameter to render UI. In silent mode (Context.IsSilent == true), view is null – step performs background work and raises Next event.
End() Resource cleanup Invoked when leaving the step. Releases resources, clears view references, and unbinds event listeners.
Next, Back, Canceled Engine communication Events signaling user intent. Steps do not switch window frames manually; instead they trigger events handled by Winstaller orchestrator.
RollbackAsync() Rollback changes Ensures system safety. If installation is aborted, Winstaller invokes RollbackAsync() on executed steps to undo changes or clean up temporary files.

4. Rendering Windows & Building Custom Views (StepViewBase)

The Winstaller engine manages the main window frame (MainWindow), window headers, fluent themes, and bottom button bar (Next, Back, Cancel). Your custom view is injected into the central container.

In the Start(IView? view) method, you call view.SetStepView(() => new MyStepView(this)). It takes a factory returning a control inheriting from StepViewBase (a WPF UserControl).

Why StepViewBase? Inheriting from StepViewBase automatically binds your WPF view with the installer's bottom button bar. Using properties like IsNextEnabled = true/false, IsBackVisible, or Title, you control main window behavior (e.g. disabling Next until a valid license key is entered).

5. Step-by-Step Implementation Guide

  1. Create C# Class Library (.NET Framework 4.7.2 or higher): Add NuGet package Winstaller.Interfaces (or reference to Winstaller.Interfaces) and WPF assemblies (PresentationFramework, PresentationCore, WindowsBase).
  2. Create XAML View (UserControl): Modify the XAML file so that the base class is interfaces:StepViewBase instead of standard UserControl. Design the user interface (textboxes, images, checkboxes).
  3. Write View Code-Behind (C#): Pass the IStep instance in the view constructor. Handle field validation and set IsNextEnabled to true or false.
  4. Implement Step Class (IStep): Decorate the class with [PluginName("YourStepName")] attribute. In the Start method, create and pass your view via view.SetStepView(...).
  5. Build & Register in config.json: Compile the DLL library, place it in the installer directory, and register it in config.json under "plugins" and "install" sections.

6. Complete Working Code Example (C# & XAML)

XAML View (MyWelcomeView.xaml)

<interfaces:StepViewBase x:Class="Winstaller.CustomSteps.MyWelcomeView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:interfaces="clr-namespace:Winstaller.Interfaces;assembly=Winstaller.Interfaces">
    <Grid Margin="20">
        <StackPanel>
            <TextBlock Text="Welcome to the application installer!" FontSize="20" FontWeight="Bold" Margin="0,0,0,10"/>
            <TextBlock Text="Enter the activation code to unlock the Next button:" Margin="0,0,0,5"/>
            <TextBox x:Name="txtLicenseKey" Padding="8" TextChanged="TxtLicenseKey_TextChanged"/>
        </StackPanel>
    </Grid>
</interfaces:StepViewBase>

View Code-Behind (MyWelcomeView.xaml.cs)

using System.Windows.Controls;
using Winstaller.Interfaces;

namespace Winstaller.CustomSteps
{
    public partial class MyWelcomeView : StepViewBase
    {
        public MyWelcomeView(IStep step)
        {
            InitializeComponent();
            Step = step;
            Title = "Introduction";
            Header = "Custom Welcome Screen";
            IsNextEnabled = false; // Disabled Next button by default
        }

        private void TxtLicenseKey_TextChanged(object sender, TextChangedEventArgs e)
        {
            // Enable Next button only when at least 5 characters are entered
            IsNextEnabled = txtLicenseKey.Text.Trim().Length >= 5;
        }
    }
}

C# Step Class (MyWelcome.cs)

using System;
using System.Threading.Tasks;
using Winstaller.Interfaces;

namespace Winstaller.CustomSteps
{
    [PluginName("MyWelcome")]
    public class MyWelcome : IStep
    {
        private MyWelcomeView? _view;
        private StepConfig? _config;

        public InstallerContext Context { get; set; } = null!;
        public int CurrentStep { get; set; }
        public int TotalSteps { get; set; }

        public event EventHandler? Next;
        public event EventHandler? Back;
        public event EventHandler? Canceled;

        public void Initialize(StepConfig config)
        {
            _config = config;
        }

        public void Start(IView? view)
        {
            if (Context.IsSilent)
            {
                // In silent mode, proceed immediately without creating GUI
                Next?.Invoke(this, EventArgs.Empty);
                return;
            }

            view?.SetStepView(() =>
            {
                _view = new MyWelcomeView(this);
                return _view;
            });
        }

        public void End() => _view = null;
        public void RaiseNext() => Next?.Invoke(this, EventArgs.Empty);
        public void RaiseBack() => Back?.Invoke(this, EventArgs.Empty);
        public void RaiseCanceled() => Canceled?.Invoke(this, EventArgs.Empty);
        public Task RollbackAsync() => Task.CompletedTask;
    }
}

Configuration in config.json

{
  "name": "Application with Custom Steps",
  "plugins": [
    "plugins/Winstaller.CustomSteps.dll"
  ],
  "install": [
    { "type": "MyWelcome" },
    { "type": "install" },
    { "type": "success" }
  ]
}

7. How to Translate the Step Code Name in the Sidebar Navigation

By default, the sidebar navigation displays the step's plugin code name (e.g. defined in [PluginName("MyWelcome")] or the "install" array). To replace this raw identifier with a localized display label (e.g. showing "Powitanie" for PL and "Introduction" for EN instead of "MyWelcome"), you can use two approaches:

Method 1: Register Key in "translations" Section (Recommended)

Winstaller treats the step plugin type name as a translation resource key. Simply add the step code name as a key in the "translations" block of your config.json file for each target language:

{
  "plugins": [ "plugins/Winstaller.CustomSteps.dll" ],
  "install": [
    { "type": "MyWelcome" }
  ],
  "translations": {
    "pl": {
      "MyWelcome": "Powitanie"
    },
    "en": {
      "MyWelcome": "Introduction"
    },
    "de": {
      "MyWelcome": "Einführung"
    }
  }
}

Method 2: Dynamically in C# View Code (Title Property)

You can also set the title dynamically in the constructor of your StepViewBase class, using LocalizationManager.GetString("MyWelcome") from the Winstaller.Interfaces package:

public MyWelcomeView(IStep step)
{
    InitializeComponent();
    Step = step;
    
    // Set dynamic title displayed on sidebar and window title bar
    Title = LocalizationManager.GetString("MyWelcome");
    Header = LocalizationManager.GetString("MyWelcome_Header");
}

8. Accessing Packaged Assets & Binaries (IResourceProvider)

All assets defined in the `resources` block of `config.json` (such as PNG/JPG images, license RTF/TXT documents, or custom binary files) are packaged inside the installer executable. Custom steps (`IStep`) and background scripts (`IScript`) can retrieve these assets at runtime via the `IResourceProvider` service obtained from `Context.GetService()`.

Available IResourceProvider Methods

Metoda Typ zwracany Opis zastosowania
HasResource(string key) bool Checks if a resource with the specified key exists in the packaged installer bundle.
GetResourceStream(string key) Stream Opens a read-only `Stream` for the resource data (e.g. for RichText document loading).
GetResourceString(string key) string Reads the resource content as a UTF-8 text string (e.g. text templates or license text).
GetResourceBytes(string key) byte[] Reads raw binary bytes (`byte[]`), ideal for images, icons, or binary assets.

Example 1: Loading a Packaged PNG Image into a WPF Image Control

using System.IO;
using System.Windows.Media.Imaging;
using Winstaller.Interfaces;

var resourceProvider = Context.GetService<IResourceProvider>();
if (resourceProvider != null && resourceProvider.HasResource("logo"))
{
    byte[] imageBytes = resourceProvider.GetResourceBytes("logo");
    using (var ms = new MemoryStream(imageBytes))
    {
        var bitmap = new BitmapImage();
        bitmap.BeginInit();
        bitmap.CacheOption = BitmapCacheOption.OnLoad;
        bitmap.StreamSource = ms;
        bitmap.EndInit();

        myLogoImage.Source = bitmap;
    }
}

Example 2: Reading a License Document or Text String

var resourceProvider = Context.GetService<IResourceProvider>();
if (resourceProvider != null && resourceProvider.HasResource("license_pl"))
{
    // Direct string reading
    string licenseText = resourceProvider.GetResourceString("license_pl");

    // Stream reading for WPF RichTextBox FlowDocument
    using (var stream = resourceProvider.GetResourceStream("license_pl"))
    {
        var range = new TextRange(myRichTextBox.Document.ContentStart, myRichTextBox.Document.ContentEnd);
        range.Load(stream, DataFormats.Rtf);
    }
}

Plugins and Script Execution

Script plugins enable running background non-UI C# tasks before (preInstall) or after (postInstall) the file extraction phase. Scripts implement the IScript interface.

Error handling depends on the execution phase: an exception thrown in a preInstall script displays an error message in the UI, halts the installation, and triggers an automatic rollback. An exception thrown in a postInstall script does not abort the installation — it is caught and reported as a warning in the installer.

C# Script Class Implementation

using Winstaller.Interfaces;

namespace MyCompany.Plugins
{
    [PluginName("DemoPreInstallScript")]
    public class PreInstallTestScript : IScript
    {
        public void Execute(InstallerContext installerContext)
        {
            var logger = installerContext.GetService<ILogger>();
            logger?.Info("DemoPreInstallScript: Checking prerequisites before installation...");
            // Custom logic, e.g. checking services or stopping processes
        }
    }
}

Configuration in config.json

{
  "plugins": [
    "libs/Winstaller.Plugins.dll"
  ],
  "scripts": {
    "preInstall": [ "DemoPreInstallScript" ],
    "postInstall": [ "DemoPostInstallScript" ]
  }
}

Translations & Localization

Winstaller features full multi-language setup execution. The interface language is automatically selected based on the target machine's OS culture or via the command-line switch (-lang=).

Built-in Supported Languages

The Winstaller engine includes built-in translations for 10 languages: en (English), pl (Polish), de (German), fr (French), es (Spanish), it (Italian), pt (Portuguese), zh (Chinese), ja (Japanese), and ru (Russian). You can restrict available languages using the allowedLanguages array in config.json.

Adding Custom Languages & Key Overrides

Adding a new language and overriding existing built-in translation keys are performed in the exact same way. In your config.json, add a "translations" object containing language codes and key-value dictionaries. Winstaller merges these translations into the runtime dictionary at startup. Existing built-in keys will be overwritten with your custom strings, and new keys will be registered for your custom UI steps.

{
  "allowedLanguages": ["en", "es"],
  "translations": {
    "en": {
      "Button_Next": "[EN]Next",
      "WelcomeStep_Title": "Setup Wizard - My Application"
    },
    "es": {
      "Button_Next": "[ES]Siguiente",
      "WelcomeStep_Title": "Asistente de instalación - Mi Aplicación"
    }
  }
}

Built-in Translation Keys Reference

Key Name English Translation Description / Location
Buttons & Navigation
Button_NextNextNext button to navigate to the next setup step.
Button_PreviousPreviousPrevious button to return to the previous setup step.
Button_CancelCancelCancel button to abort installation or uninstallation.
Button_FinishFinishFinish button to exit the wizard after successful completion.
Button_CloseCloseClose button in dialog windows.
Button_RetryRetryRetry button after an installation error.
Button_OKOKOK confirmation button in message dialogs.
Button_YesYesYes confirmation button in confirmation prompts.
Button_NoNoNo rejection button in confirmation prompts.
Sidebar Step Names
welcomeWelcomeWelcome step label in navigation sidebar.
licenseLicenseLicense agreement step label.
installtypeSetup OptionsInstallation directory and scope step label.
installInstallationFile copying and installation progress step label.
successFinishCompletion and summary step label.
confirmuninstallConfirmationUninstallation confirmation step label.
uninstallUninstallationUninstallation progress step label.
Welcome Step
WelcomeStep_TitleInstallation - {0}Window title bar text on welcome screen ({0} = app name).
WelcomeStep_HeaderWelcome to the {0} installerMain welcome header on the first screen.
WelcomeStep_DescriptionDefaultThis program will install {0} on your computer...Default description text recommending closing other applications.
WelcomeStep_VersionVersion:Label for application version string.
WelcomeStep_PublisherPublisher:Label for publisher name string.
License Step
LicenseStep_TitleLicense AgreementHeader for EULA license agreement step.
LicenseStep_AcceptTermsI accept the terms in the License AgreementCheckbox text for accepting license terms.
LicenseStep_MustAcceptTitleAcceptance RequiredWarning dialog title when license is not accepted.
LicenseStep_MustAcceptTextYou must accept the terms of the license agreement...Warning message requiring license acceptance to proceed.
Directory & Scope Step
DefaultStep_TitleInstallation DirectoryHeader for destination directory selection view.
DefaultStep_InstallLocationInstallation Location:Label above target path input field.
DefaultStep_BrowseBrowse...Browse button to open system folder picker.
DefaultStep_DesktopShortcutCreate desktop shortcutOption checkbox to create Desktop shortcut.
DefaultStep_StartMenuShortcutCreate Start Menu shortcutOption checkbox to create Start Menu shortcut.
DefaultStep_DescriptionDefaultThe application {0} will be installed in the selected directory.Default description showing target directory for application {0}.
DefaultStep_BrowseDescriptionSelect installation directoryTitle for system folder browser dialog.
DefaultStep_PathEmptyMessagePlease select installation directory.Validation error message when path input is empty.
DefaultStep_ValidationErrorTitleValidation ErrorTitle for path validation error dialog.
DefaultStep_PathInvalidMessageInvalid installation path: {0}Validation error message for invalid target path {0}.
InstallTypeStep_TitleInstallation ScopeHeader for installation scope selection (Local vs System).
InstallTypeStep_HeaderChoose Installation ScopeMain header on scope selection screen.
InstallTypeStep_DescriptionPlease select whether you want to install this application...Description explaining local per-user vs machine-wide install.
InstallTypeStep_LocalLabelInstall for me only (Local)Radio option label for installing for current user only.
InstallTypeStep_LocalDescThe application will be installed in your user profile folder...Description for per-user profile installation (no UAC required).
InstallTypeStep_SystemLabelInstall for all users (System)Radio option label for installing for all users.
InstallTypeStep_SystemDescThe application will be installed in Program Files...Description for Program Files installation (requires UAC elevation).
InstallTypeStep_PathLabelInstallation path:Label displaying active installation path.
Install Progress & Services
InstallStep_InstallingInstalling...Progress status text during file extraction.
InstallStep_InstallingTitleInstalling FilesHeader for file copying and extraction section.
InstallStep_PreparingInstallPreparing installation...Initial status message before copying begins.
InstallStep_InstallStarted=== Installation started ===Log entry header indicating start of installation.
InstallStep_InstallSuccessInstallation completed successfully!Summary message upon completing file extraction.
InstallStep_InstallCompletedLog=== Installation completed ===Log entry indicating installation finished.
InstallStep_InstallErrorInstallation error!Error title when file copying or registration fails.
InstallStep_DetailsLabelDetails:Toggle button label for log details expander.
InstallStep_RegisteringRegistering application...Status text when registering app in Windows Control Panel.
InstallStep_RunningPreScriptsRunning pre-installation scripts...Status text while running pre-install background scripts.
InstallStep_RunningPostScriptsRunning post-installation scripts...Status text while running post-install background scripts.
InstallStep_StoppingServiceStopping service...Status text while stopping running Windows Service.
InstallStep_RemovingOldServiceRemoving service...Status text while removing existing Windows Service.
InstallStep_InstallingServiceInstalling service...Status text while registering new Windows Service.
InstallStep_StartingServiceStarting service...Status text while starting installed Windows Service.
InstallStep_RollbackStatusRolling back changes and restoring computer state...Status text during automatic rollback after an error.
InstallStep_RollbackStartedRolling back changes...Log entry indicating rollback sequence initiated.
Success & Finish Step
SuccessStep_TitleInstallation CompletedWindow title bar text on final completion screen.
SuccessStep_HeaderInstallation Completed SuccessfullyMain success header on final screen.
SuccessStep_DescriptionDefaultThe installation of {0} completed successfully...Default completion message for application {0}.
SuccessStep_LaunchAppLaunch {0}Checkbox label to automatically launch app upon exit.
SuccessStep_UninstallTitleUninstallation CompletedWindow title bar text after successful uninstallation.
SuccessStep_UninstallHeaderUninstallation Completed SuccessfullyMain header on uninstallation completion screen.
SuccessStep_UninstallDescriptionDefaultThe uninstallation of {0} completed successfully...Default description message after uninstalling app {0}.
Uninstallation Steps
ConfirmStep_TitleUninstall ConfirmationWindow title for uninstall confirmation prompt.
ConfirmStep_MessageDefaultAre you sure you want to uninstall {0}?Confirmation message asking if user wants to uninstall {0}.
InstallStep_UninstallingTitleUninstallation in ProgressHeader for uninstallation progress screen.
InstallStep_PreparingUninstallPreparing uninstallation...Initial status text before removing files.
UninstallService_DeletingFileDeleting file: {0}Log entry for file deletion.
UninstallService_DeletingDirectoryDeleting directory: {0}Log entry for directory deletion.
UninstallService_CompletedUninstallation completed successfullyLog entry for successful uninstallation.
Errors & Dialogs
InstallStep_ErrorNoPermissionInstallation failed due to insufficient permissions...Error message when UAC administrator privileges are missing.
InstallStep_ErrorElevationRequiredElevation was rejected...Error message when user rejects UAC prompt.
InstallStep_ErrorDiskFullInstallation failed because the disk is full...Error message when target disk is out of space.
InstallStep_ErrorWriteFailedInstallation failed due to a file write error.Error message when writing file fails.
InstallStep_ErrorAppLockedInstallation blocked. The following applications are running: {0}...Error message when running application processes block install.
InstallStep_ErrorFilesLockedInstallation blocked. The following files are in use: {0}...Error message when locked files block installation.
InstallStep_ErrorDirectoryLockedThe installation directory is locked...Error message when installation directory is locked.
InstallStep_RetryPrompt{0}\n\nDo you want to close applications/release files and try again?...Retry prompt asking user to close applications and try again.
Message_ConfirmCancelTitleCancel InstallationDialog title when user clicks Cancel during installation.
Message_ConfirmCancelDescriptionAre you sure you want to cancel the installation and roll back any changes?Dialog description asking to confirm cancellation and rollback.
App_Error_AdminRequiredThis installer requires administrator privileges...Error prompt stating installer requires administrator privileges.
RetryDialog_TitleAction RequiredTitle for action-required retry dialog.
Updater_TitleSoftware UpdateTitle for auto-updater window.
Updater_NewVersionPromptA newer version ({0}) is available. Do you want to update now?Prompt notifying user of a new software version.