GZUpdate.Client.Win 26.101.1004

dotnet add package GZUpdate.Client.Win --version 26.101.1004
                    
NuGet\Install-Package GZUpdate.Client.Win -Version 26.101.1004
                    
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="GZUpdate.Client.Win" Version="26.101.1004" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GZUpdate.Client.Win" Version="26.101.1004" />
                    
Directory.Packages.props
<PackageReference Include="GZUpdate.Client.Win" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GZUpdate.Client.Win --version 26.101.1004
                    
#r "nuget: GZUpdate.Client.Win, 26.101.1004"
                    
#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.
#:package GZUpdate.Client.Win@26.101.1004
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GZUpdate.Client.Win&version=26.101.1004
                    
Install as a Cake Addin
#tool nuget:?package=GZUpdate.Client.Win&version=26.101.1004
                    
Install as a Cake Tool

GZUpdate.Client.Win

GZUpdate.Client.Win 是 GZUpdate.Client 的 WinForms 开箱即用集成包。业务项目只需要设置一次升级参数,再调用检查升级方法即可。

安装

<PackageReference Include="GZUpdate.Client.Win" Version="26.1.1002" />

启动时自动检查并升级

using GZUpdate.Client;
using GZUpdate.Client.Win;

[STAThread]
static void Main()
{
    // .NET Framework 项目可替换为 Application.EnableVisualStyles()
    // 和 Application.SetCompatibleTextRenderingDefault(false)。
    ApplicationConfiguration.Initialize();

    WinUpdateClient.Configure(
        server: "https://update.infnitee.com/",
        productId: "YourProductId",
        versionType: EnumVersionType.release,
        upgradeExecutorDllPath: "__upgrade_executor_dll");

    var result = WinUpdateClient.CheckAndUpdate();
    if (result.ShouldExitApplication)
        return;

    Application.Run(new MainForm());
}

启动模式下,如果发现新版本,包会显示默认升级进度弹窗;升级成功后会自动启动新实例,调用方根据 ShouldExitApplication 停止继续打开主窗体。

手动检查更新

主窗体中可以这样绑定“检查更新”按钮:

void BtnCheckUpdate_Click(object sender, EventArgs e)
{
    WinUpdateClient.CheckAndUpdate(this, WinUpdateMode.Manual);
}

手动模式下,发现新版本会先询问用户是否升级;升级完成后默认保留弹窗上的“重启”按钮,由用户手动重启。

可选配置

如果需要更多控制,可以使用 WinUpdateOptions:

WinUpdateClient.Configure(new WinUpdateOptions
{
    Server = "https://update.infnitee.com/",
    ProductId = "YourProductId",
    VersionType = EnumVersionType.release,
    UpgradeExecutorDllPath = "__upgrade_executor_dll",
    RestartAfterStartupUpdate = true,
    RestartAfterManualUpdate = false,
    PromptBeforeManualUpdate = true,
    ShowNoUpdateMessage = true
});

自定义升级弹窗

实现 IWinUpdateProgressDialogFactory 和 IWinUpdateProgressDialog,再通过 Configure 注入:

WinUpdateClient.Configure(
    server: "https://update.infnitee.com/",
    productId: "YourProductId",
    versionType: EnumVersionType.release,
    upgradeExecutorDllPath: "__upgrade_executor_dll",
    progressDialogFactory: new YourUpdateDialogFactory());

自定义弹窗需要处理这些方法:

  • SetMessage:显示当前升级消息。
  • SetDownloadProgress:显示下载进度。
  • SetPackageProgress:显示升级包数量进度。
  • SetComplete:显示升级完成状态。
  • SetFailure:显示升级失败状态。
  • EnableClose / RequestClose:控制弹窗关闭。

返回结果

CheckAndUpdate 返回 WinUpdateResult:

  • Status:本次检查/升级状态。
  • IsUpdated:是否已完成升级。
  • ShouldExitApplication:是否应停止当前启动流程。
  • LatestVersion:检测到的最新版本。
  • CurrentVersion:升级后写入的当前版本。
  • Error:失败异常。
Product Compatible and additional computed target framework versions.
.NET net5.0-windows7.0 is compatible.  net6.0-windows was computed.  net7.0-windows was computed.  net7.0-windows7.0 is compatible.  net8.0-windows was computed.  net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
.NET Framework 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
26.101.1004 107 9/3/2026