Blog | G5 Cyber Security

Auto-Update Client Apps

TL;DR

This guide shows you how to automatically update client applications installed on users’ computers. We’ll cover checking for updates, downloading them, and installing them without needing the user to do anything manually.

1. Choose an Update Method

There are several ways to handle auto-updates. Here are a few common options:

2. Setting up Squirrel.Windows (Example)

Squirrel.Windows is a popular choice for Windows applications.

2.1 Install the NuGet Package

In Visual Studio, use the NuGet Package Manager to install Squirrel.Windows into your project:

Install-Package Squirrel.Windows

2.2 Configure Your Application

Add the following code to your application’s startup (e.g., in Main()):

using Squirrel; 

// ... other setup code ...

SquirrelSetup.Initialize(() => {
    return new UpdateManifest()
    {
        Identifier = "YourAppName",
        Version = Assembly.GetExecutingAssembly().GetName().Version,
    };
});

Replace "YourAppName" with a unique identifier for your application.

2.3 Create an Update Manifest

The update manifest (UpdateManifest) describes the new version of your app. Squirrel will automatically handle creating this file during the build process when you publish your application.

3. Creating and Publishing Updates

3.1 Build Your Updated Application

Increment the version number in your project’s properties (e.g., AssemblyInfo.cs).

3.2 Publish Your Application

When you publish your application, Squirrel will automatically create an update package and upload it to a designated location. You can configure this location in your project settings.

4. Update Checking

Squirrel automatically checks for updates periodically in the background.

4.1 Configure Check Interval

You can configure how often Squirrel checks for updates using settings files or command-line arguments during installation.

5. Handling Updates

When a new update is found, Squirrel will:

6. Testing Your Auto-Update System

  1. First Run: Install the initial version of your application.
  2. Increment Version: Build a new version with an incremented version number.
  3. Publish Update: Publish the updated application package to your chosen location.
  4. Verify Update: The application should automatically detect and install the update after the configured check interval.

7. Important Considerations

Exit mobile version