Revision indexing in progress... (search in this revision will be accurate after indexed)
.agents Loading last commit info...
src
templates/InstallerBase
tests/InstallerFramework.Tests
.gitignore
Directory.Build.props
GENERATE-INSTALLER.md
InstallerFramework.slnx
README.md
README.md

Modern Windows Installer Framework (.NET Core + Avalonia UI)

A modern, highly customizable C# installer wizard framework built with .NET Core and Avalonia UI. It provides the sleek visual aesthetic of modern installers (such as Firefox or Chrome setup wizards) while maintaining the familiar, intuitive step-by-step layout of classic Windows setup wizards.


Features

  • Classic Wizard Layout & Modern Aesthetic: Compact window dimensions (680x480), dark/light theme support, top header banner, dynamic wizard steps, and standard bottom navigation controls (< Back, Next >, Cancel, Finish).
  • Simple C# Fluent API: Configure your entire installer (pages, actions, validation rules, branding) in just a few lines of code.
  • Built-in Installation Actions:
    • CopyDirectoryAction: Recursive file copying with real-time per-file extraction reporting.
    • ExtractZipAction: Zip archive extraction with progress callbacks.
    • DownloadAction: HTTP/HTTPS file download with percentage & byte tracking.
    • ExecuteCommandAction: Run shell scripts, batch files, powershell scripts, or custom executables with stdout/stderr piped into the UI.
    • CreateShortcutAction: Desktop & Start Menu shortcut link creation.
  • Classic File Log Box: Built-in real-time scrollable log window displaying file-by-file progress (Copying bin/app.exe... [OK]) alongside an overall percentage progress bar.
  • Custom Configuration Pages (ConfigPages): Dynamic UI form builder supporting checkboxes, text inputs, password fields, and dropdowns. Field values are passed to subsequent installer steps via {key} template placeholders.
  • Native Folder Browser & Disk Space Checker: Native OS folder browser picker (StorageProvider) with automatic drive free space calculation and admin privilege warning detection.
  • UAC Admin Elevation: Auto-detects if target directories (e.g. C:\Program Files\) require Administrator privileges and seamlessly prompts UAC elevation (runas).

Quickstart: Creating an Installer in C#

using InstallerFramework.Core.Actions;
using InstallerFramework.Core.Builder;
using InstallerFramework.Core.Services;
using InstallerFramework.UI;

public class Program
{
    [STAThread]
    public static void Main(string[] args)
    {
        var config = InstallerBuilder.Create("My Cool App")
            .WithVersion("1.0.0")
            .WithPublisher("Acme Corp")
            .WithDefaultDirectory(@"{LocalAppData}\Programs\MyCoolApp")
            .RequireAdmin(ElevationMode.AutoDetect)
            
            // 1. Welcome Page
            .AddWelcomePage(welcomeText: "Welcome to My Cool App setup wizard.")
            
            // 2. License Agreement Page
            .AddLicensePage(licenseText: "MIT License text goes here...")
            
            // 3. Destination Folder Selection Page
            .AddDirectoryPage()
            
            // 4. Custom Configuration Page (User UI inputs)
            .AddConfigPage(c => c
                .WithTitle("Setup Configuration", "Choose initial application settings.")
                .AddCheckbox("create_shortcut", "Create Desktop Shortcut", defaultValue: true)
                .AddTextInput("server_port", "Server Network Port", defaultValue: "8080", isRequired: true)
                .AddDropdown("ui_mode", "Interface Mode", new[] { "Modern Dark", "Classic Light" }))
            
            // 5. Installation Actions (Executed on Progress Page)
            .AddStep("Extracting Payload", new ExtractZipAction("payload.zip", "{TargetDir}"))
            .AddStep("Executing Setup Script", new ExecuteCommandAction("cmd.exe", "/c setup.bat {server_port}"))
            
            // 6. Finish / Completion Page
            .AddCompletionPage(launchExecutableOnFinish: "{TargetDir}/MyCoolApp.exe")
            .Build();

        // Launch Avalonia Installer Wizard UI
        InstallerRunner.Run(config, args);
    }
}

Solution Structure

  • src/InstallerFramework.Core: Action pipeline, template context engine, elevation service, and fluent builder.
  • src/InstallerFramework.UI: Avalonia UI controls, wizard window, page views, viewmodels, and live log viewer.
  • src/SampleInstaller: Demo executable demonstrating a complete setup wizard application.
  • tests/InstallerFramework.Tests: xUnit test suite for engine verification.

Building & Publishing

To build a standalone single-file Windows installer executable:

dotnet publish src/SampleInstaller/SampleInstaller.csproj -c Release -r win-x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover