Skip to content

Instantly share code, notes, and snippets.

@anaisbetts
Last active April 18, 2020 02:00
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anaisbetts/599b435c05bb0e8a4080 to your computer and use it in GitHub Desktop.
Save anaisbetts/599b435c05bb0e8a4080 to your computer and use it in GitHub Desktop.
Getting Started with Squirrel for Windows

Getting Started

Here's how to take any EXE and create an installer for it:

  1. Install-Package squirrel.windows
  2. Use NuGet Package Explorer (or any other way) to create a NuGet package for your app.
  3. Open the NuGet Package Console, and type Squirrel --releasify path/to/the/nuget/package.nupkg

You should have a folder called Releases with three files in it. Publish those all to S3 in the same folder and you've now got an installer

Handling Squirrel events

Squirrel events are optional, but they can be super useful, as it gives you a chance to do "custom install actions" on install / uninstall / update.

In your app's AssemblyInfo.cs, add the following line:

[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]

This means that your app will be executed by the installer, in a number of different scenarios, with special flags - you should handle them correctly:

  • --squirrel-install x.y.z.m - called when your app is installed. Exit as soon as you're finished setting up the app
  • --squirrel-firstrun - called after everything is set up. You should treat this like a normal app run (maybe show the "Welcome" screen)
  • --squirrel-updated x.y.z.m - called when your app is updated to the given version. Exit as soon as you're finished.
  • --squirrel-uninstall - called when your app is uninstalled. Exit as soon as you're finished.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment