How squirrel/squirrel.windows works
1. What this repo is
Squirrel.Windows is an installer/update platform for Windows desktop apps. The architecture is centered on a release feed plus an app-local updater, rather than a traditional MSI-style installer.
2. Top-level split: managed library vs native bootstrapper
The codebase is divided into a managed C# core (src/Squirrel) and several native C++ utilities/bootstrap components (src/Setup, src/StubExecutable, src/WriteZipToSetup). That split matters because initial install, update orchestration, and package manipulation are handled by different runtimes.
3. Managed update engine (src/Squirrel)
This is the main reusable API surface. UpdateManager and related classes (ReleasePackage, ReleaseEntry, DeltaPackage, UpdateInfo, FileDownloader) implement the end-to-end update workflow: check feed, download packages, decide whether to use delta/full packages, and apply releases. The API is exposed through IUpdateManager.
4. Release/package model
Squirrel uses NuGet packages as the artifact format for app releases. The important data boundary is the RELEASES manifest and the .nupkg files it references. The code contains support for package metadata, shell file handling, markdown parsing, and delta patching/compression (BinaryPatchUtility, MsDeltaCompression), which are all part of turning package versions into installable app states.
5. Per-app maintenance executable (Update.exe)
src/Update builds the command-line updater/maintenance tool that lives alongside an installed app. It is responsible for app lifecycle operations such as install, update, shortcut/taskbar behavior, signing-related helpers, and handling Squirrel-specific startup events. The use of Mono.Options and multiple command-line entry points shows this is a local orchestration binary, not a UI app.
6. Native bootstrap installer (Setup.exe)
src/Setup contains the bootstrapper that starts a first-time install or launch path. It includes platform-specific helpers like MachineInstaller, FxHelper, and UpdateRunner, plus WTL UI resources. This component is the boundary between “downloaded package contents” and “installed application directory/shortcuts.”
7. Embedded payload and installer assembly
src/WriteZipToSetup and the update.zip/flags1.bin artifacts indicate that the bootstrapper is assembled with an embedded zip payload. This is a packaging boundary: the native setup binary is combined with update content so it can bootstrap installation without requiring a separate installer framework.
8. Version detection and app-awareness
The library includes SquirrelAwareApp and SquirrelAwareExecutableDetector, which separate apps that know how to respond to Squirrel lifecycle events from those that don’t. This boundary matters because the updater may need to launch the app with special arguments or suppress normal startup during install/update transitions.
9. Release-feed tooling and synchronization
src/SyncReleases is a command-line utility for managing/syncing release feeds, likely for publishing or mirroring RELEASES files and package sets. It is part of the distribution pipeline rather than the runtime update engine.
10. Distribution is intentionally storage-agnostic
The documentation shows Squirrel can consume packages over simple HTTP and integrates with hosting models such as GitHub, Amazon S3, IIS, TeamCity, and Octopack. Architecturally, the app does not depend on a specific server product; it only requires a reachable release feed and package files.
11. Install/update flow boundary
At runtime, the app checks for updates through UpdateManager, downloads release artifacts, applies them locally, and then hands control back to the installed app. The installer/update process is therefore mostly local disk I/O plus HTTP download, with the external feed serving as the only remote dependency.
12. Test and validation layer
test/Squirrel.Tests uses many package and feed fixtures, plus helpers like StaticHttpServer, to simulate real update scenarios. The tests validate package parsing, update decisions, feed handling, and installer behavior against representative .nupkg and RELEASES inputs.
Main entry points: UpdateManager.cs UpdateManager · ReleasePackage.cs Release model · Setup Setup.exe · Squirrel.Tests Squirrel tests
Components 20
src
Production code
- Update engine · Reusable C# API for checking feeds, downloading releases, and applying updates.
src/Squirrel - UpdateManager · Coordinates update discovery, download, install, and application flows.
src/Squirrel/UpdateManager.cs - Check updates · Checks a release feed and computes available updates.
src/Squirrel/UpdateManager.CheckForUpdates.cs - Download releases · Fetches release artifacts and manifests from the feed.
src/Squirrel/UpdateManager.DownloadReleases.cs - Apply releases · Applies downloaded releases into the local app installation.
src/Squirrel/UpdateManager.ApplyReleases.cs - Release model · Represents release entries, packages, and update metadata.
src/Squirrel/ReleasePackage.cs - Release entry · Parses RELEASES entries and package version references.
src/Squirrel/ReleaseEntry.cs - Delta patching · Handles delta packages and binary patch application.
src/Squirrel/DeltaPackage.cs - Downloader · Downloads packages and release assets over HTTP or similar transport.
src/Squirrel/FileDownloader.cs - Package tools · Helpers for package content type, shell files, markdown, and compression.
src/Squirrel/BinaryPatchUtility.cs - Aware apps · Detects Squirrel-aware executables and lifecycle-aware startup behavior.
src/Squirrel/SquirrelAwareApp.cs - Update.exe · Installed-app command line tool for local lifecycle and maintenance operations.
src/Update - Setup.exe · First-run installer/bootstrapper that lays down the app and shortcuts.
src/Setup - Update runner · Drives install/update execution from the native bootstrapper.
src/Setup/UpdateRunner.cpp - Machine install · Handles machine-wide install logic and Windows integration tasks.
src/Setup/MachineInstaller.cpp - Framework helper · Checks and prepares runtime prerequisites for setup execution.
src/Setup/FxHelper.cpp - Payload pack · Builds and embeds the zip payload used to assemble Setup.exe.
src/WriteZipToSetup/WriteZipToSetup.cpp - SyncReleases · Command-line utility for synchronizing or publishing release feeds.
src/SyncReleases/Program.cs
test
Validation and fixtures
- Squirrel tests · Integration and unit tests covering update behavior and package parsing.
test/Squirrel.Tests - HTTP server · Static HTTP server used to simulate remote release feeds in tests.
test/Squirrel.Tests/TestHelpers/StaticHttpServer.cs
Connections 19
- Update engine → UpdateManager: contains · The managed library centers on the update manager API.
- UpdateManager → Check updates: checks · UpdateManager delegates feed discovery to the check stage.
- UpdateManager → Download releases: downloads · UpdateManager coordinates release acquisition.
- UpdateManager → Apply releases: applies · UpdateManager drives local installation of new releases.
- UpdateManager → Release model: uses · UpdateManager consumes release metadata and package records.
- Release model → Release entry: parses · Release metadata is represented through release entries.
- Release model → Delta patching: selects · The release model distinguishes delta and full packages.
- Download releases → Downloader: uses · The download stage relies on a downloader component.
- Apply releases → Package tools: uses · Applying releases depends on package and patch helpers.
- Package tools → Delta patching: supports · Patch/compression helpers enable delta package handling.
- Aware apps → Update.exe: enables · Lifecycle-aware apps are launched through the maintenance tool.
- Setup.exe → Update runner: drives · The native bootstrapper uses the update runner for install flow.
- Setup.exe → Machine install: includes · Bootstrapper includes machine-wide installation behavior.
- Setup.exe → Framework helper: checks · Setup verifies prerequisites before continuing.
- Payload pack → Setup.exe: assembles · The payload is embedded into the setup binary.
- SyncReleases → Release model: manages · Sync tooling works on release feeds and package sets.
- Squirrel tests → UpdateManager: covers · Tests validate update decisions and application flow.
- Squirrel tests → Release model: covers · Tests validate package parsing and release metadata.
- Squirrel tests → HTTP server: uses · Tests simulate remote feeds with a local HTTP server.