Hanson.AutoUpdater 2.4.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Hanson.AutoUpdater --version 2.4.2                
NuGet\Install-Package Hanson.AutoUpdater -Version 2.4.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hanson.AutoUpdater" Version="2.4.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Hanson.AutoUpdater --version 2.4.2                
#r "nuget: Hanson.AutoUpdater, 2.4.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Hanson.AutoUpdater as a Cake Addin
#addin nuget:?package=Hanson.AutoUpdater&version=2.4.2

// Install Hanson.AutoUpdater as a Cake Tool
#tool nuget:?package=Hanson.AutoUpdater&version=2.4.2                

README

Hanson.AutoUpdater

功能說明

提供導入跨平台的 FileUpdate 應用程式時使用的套件

主要功能

  1. 支援 http 檔案方式進行版本更新
  2. 啟動 FileUpdate 的更新機制

前置條件

  • 開發環境需具備 .Net6.0 or .Net Core 3.1 or NET 472 or NET 462

  • 運行於 Windows Platform (x86, x64)

  • 運行於 Linux Platform (x86, x64)

  • 運行於 Raspberry PI Platform (x86)

  • 需配合 FileUpdate v2.0.0 以後版本

安裝方式

授權

此專案採用的 License為 Apache-2.0

使用範例

  • 建立更新資訊 update.json
{
  "app_name": "Sample-App", 
  "app_version": "1.0.1", // app 當前版本
  "app_restart_command": "lxterminal", // 此為 linux 環境範例
  "app_restart_command_args": "-e dotnet Sample-App.dll",
  "download_timeout_ms": 10000, // 下載檔案的 timeout 時間
  "descp": "This is the Sample-App-v1.0.1 software update package.", 
  "publish_url": "", // App 要更新檔案的下載位置, 無填寫時預設使用 update.json 的下載位置
  "package": "update.zip", // App 要更新檔案的名稱,一定要為 zip
  "md5": "1EBADE26BB7987E3EAB92797CD98AC60", //package檔案進行 MD5 的檢查碼
  "required_min_version": "1.0.0" //最小更新版本
}
  • Auto Updater 簡易使用範例
 private async Task CheckUpdateAsync()
{
    var url = "http://127.0.0.1/update/SampleConsoleApp";
    AutoUpdater autoUpdater = new AutoUpdater();
    (bool isRunUpdate, UpdateInfo updateInfo) = await autoUpdater.CheckVersionAsync(updateServerUrl);

    if (isRunUpdate == default)
    {
        Console.WriteLine("Version check failed, please check that the network or publisher server is ready?");
    }
    else
    {
        if (isRunUpdate)
        {
            Console.WriteLine("Start to execute auto-update.");
            autoUpdater.Start(updateInfo);
        }
        else
        {
            Console.WriteLine("The software version has been updated to the latest.");
        }
    }
}
  • Auto Updater 使用設定檔的範例
private async Task CheckUpdateAsyncUseConfig()
{
    Config config = new Config
    {
        AppCommand = "FileUpdate.exe",
        AppCommandArgs = "",
        HttpClientTimeout = 1000,
        UpdateFolder = "FileUpdate"
    };
    AutoUpdater autoUpdater = new AutoUpdater(config);
    (bool isRunUpdate, UpdateInfo updateInfo) = await autoUpdater.CheckVersionAsync(UPDATE_SERVER_URL);

    if (isRunUpdate == default)
    {
        Console.WriteLine("Version check failed, please check that the network or publisher server is ready?");
    }
    else
    {
        if (isRunUpdate)
        {
            Console.WriteLine("Start to execute auto-update.");
            autoUpdater.Start(updateInfo);
        }
        else
        {
            Console.WriteLine("The software version has been updated to the latest.");
        }
    }
}
  • Auto Updater 指定設定檔(config name)的範例
private async Task CheckUpdateAsyncUseConfig()
{
    var appName = Assembly.GetExecutingAssembly().GetName().Name;
	var configName = $"{appName}.json";
    Config config = new Config
    {
        AppCommand = "FileUpdate.exe",
        AppCommandArgs = configName,
        HttpClientTimeout = 1000,
        UpdateFolder = "FileUpdate"
    };
    AutoUpdater autoUpdater = new AutoUpdater(config);
    (bool isRunUpdate, UpdateInfo updateInfo) = await autoUpdater.CheckVersionAsync(UPDATE_SERVER_URL);

    if (isRunUpdate == default)
    {
        Console.WriteLine("Version check failed, please check that the network or publisher server is ready?");
    }
    else
    {
        if (isRunUpdate)
        {
            Console.WriteLine("Start to execute auto-update.");
            autoUpdater.Start(updateInfo,configName);
        }
        else
        {
            Console.WriteLine("The software version has been updated to the latest.");
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 135 3/12/2024
2.5.0 144 1/22/2024
2.4.2 115 1/22/2024
2.4.1 105 1/18/2024
2.4.0 115 1/18/2024