Home

Awesome

Onova

Status Made in Ukraine Build Coverage Version Downloads Discord Fuck Russia

<table> <tr> <td width="99999" align="center">Development of this project is entirely funded by the community. <b><a href="https://tyrrrz.me/donate">Consider donating to support!</a></b></td> </tr> </table> <p align="center"> <img src="favicon.png" alt="Icon" /> </p>

Onova is a lightweight auto-update framework for desktop applications. It's primarily designed for performing in-place updates for portable applications distributed via archive files (as opposed to installers or packages). The library requires minimal configuration, doesn't impose any changes to the CI/CD process, and doesn't affect the life cycle of your application.

✨ See also Onova.Publisher β€” community project that provides an integrated installation experience based on Onova.

Terms of use<sup>[?]</sup>

By using this project or its source code, for any purpose and in any shape or form, you grant your implicit agreement to all the following statements:

To learn more about the war and how you can help, click here. Glory to Ukraine! πŸ‡ΊπŸ‡¦

Install

Features

Workflow

Package resolving

Packages and their versions are resolved using an implementation of IPackageResolver. Currently there are 5 built-in implementations:

LocalPackageResolver

This implementation looks for files in the specified directory using a predefined pattern. Package versions are extracted from file names, e.g. file named MyProject-v2.1.5.zip corresponds to package version 2.1.5.

GithubPackageResolver

This implementation looks for assets in releases of specified GitHub repository using a predefined pattern. Package versions are extracted from release names, e.g. release named v1.0 corresponds to package version 1.0.

Since .NET assemblies do not support semantic versions, pre-releases are ignored.

WebPackageResolver

This implementation requests a version manifest using the specified URL. The server is expected to respond with a plain-text list of package versions and their URLs, separated by space, one line per package. E.g.:

1.0 https://my.server.com/1.0.zip
2.0 https://my.server.com/2.0.zip

NugetPackageResolver

This implementation resolves packages from the specified NuGet feed.

Since .NET assemblies do not support semantic versions, pre-releases are ignored.

AggregatePackageResolver

This implementation provides aggregation over multiple other IPackageResolver instances. It allows resolving and downloading packages from more than one source.

Package extraction

Downloaded packages are extracted using an implementation of IPackageExtractor. Currently there are 2 built-in implementations:

ZipPackageExtractor

This implementation extracts files from zip-archived packages.

NugetPackageExtractor

This implementation extracts files from NuGet packages, from the specified root directory.

Usage

Basic usage example

The following code checks for updates and installs them if they are available, in a single operation.

// Configure to look for packages in specified directory and treat them as zips
using (var manager = new UpdateManager(
    new LocalPackageResolver("c:\\test\\packages", "*.zip"),
    new ZipPackageExtractor()))
{
    // Check for new version and, if available, perform full update and restart
    await manager.CheckPerformUpdateAsync();
}

Handling intermediate steps manually

To provide users with the most optimal experience, you will probably want to handle intermediate steps manually.

// Check for updates
var result = await manager.CheckForUpdatesAsync();
if (result.CanUpdate)
{
    // Prepare an update by downloading and extracting the package
    // (supports progress reporting and cancellation)
    await manager.PrepareUpdateAsync(result.LastVersion);

    // Launch an executable that will apply the update
    // (can be instructed to restart the application afterwards)
    manager.LaunchUpdater(result.LastVersion);

    // Terminate the running application so that the updater can overwrite files
    Environment.Exit(0);
}

Handling updates with multiple running instances of the application

To prevent conflicts when running multiple instances of the same application, only one instance of UpdateManager (across all processes) is able to prepare updates and launch the updater.

In order to correctly handle cases where multiple instances of the application may try to update at the same time, you need to catch these exceptions:

The updater will wait until all instances of the application have exited before applying an update, regardless of which instance launched it.

Etymology

The name "Onova" is derived from the Ukrainian word for "update" (noun).