JiuLing.AutoUpgrade
3.0.2
dotnet add package JiuLing.AutoUpgrade --version 3.0.2
NuGet\Install-Package JiuLing.AutoUpgrade -Version 3.0.2
<PackageReference Include="JiuLing.AutoUpgrade" Version="3.0.2" />
<PackageVersion Include="JiuLing.AutoUpgrade" Version="3.0.2" />
<PackageReference Include="JiuLing.AutoUpgrade" />
paket add JiuLing.AutoUpgrade --version 3.0.2
#r "nuget: JiuLing.AutoUpgrade, 3.0.2"
#:package JiuLing.AutoUpgrade@3.0.2
#addin nuget:?package=JiuLing.AutoUpgrade&version=3.0.2
#tool nuget:?package=JiuLing.AutoUpgrade&version=3.0.2
<p align="center"> <a href="https://github.com/JiuLing-zhang/JiuLing.AutoUpgrade" target="_blank"><img src="https://github.com/JiuLing-zhang/JiuLing.AutoUpgrade/raw/main/docs/resources/images/logo.png" ></a> </p>
<div align="center">
</div>
👾 一个简单、易用的自动更新组件。 👉👉English Version
<div align="center"> <img src="https://github.com/JiuLing-zhang/JiuLing.AutoUpgrade/raw/main/docs/resources/images/demo1.png" width="40%"> <img src="https://github.com/JiuLing-zhang/JiuLing.AutoUpgrade/raw/main/docs/resources/images/demo2.png" width="40%"> </div>
介绍
更新程序的核心程序是基于 .NET Framework 4.7 开发的 x64 格式的程序,所以使用此组件之前,请先确保客户端环境能够运行该程序。
- 🔥 组件支持自更新
- 🌈 支持 HTTP
- 🌀 支持 FTP
- ⚡ 支持 GitHub Release
- ⭐ 版本过期后禁止运行
运行方式
- 🕐 去服务端下载更新包(如果有更新可用)
- 🕑 关闭主程序
- 🕒 将更新包的内容解压后复制到主程序根目录
- 🕓 重启主程序
🎈 检查更新时,如果指定了最小运行版本,并且主程序版本低于最小版本,那么自动更新程序将不允许跳过本次更新,不更新直接关闭自动更新程序时,同时也会关闭主程序
🎉 更新包仅支持 .zip 压缩包。
安装
🟢 通过 Nuget 安装。
🟢 通过 Release 下载。
使用
1️⃣ 导入命名空间
using JiuLing.AutoUpgrade.Shell;
2️⃣ 创建更新程序
// HTTP 方式
IUpgradeApp app = UpgradeFactory.CreateHttpApp("url");
// FTP 方式
IUpgradeApp app = UpgradeFactory.CreateFtpApp("path", "username", "password");
// GitHub Release 方式
// assetName: update.zip
IUpgradeApp app = UpgradeFactory.CreateGitHubApp("owner", "repo", "assetName");
3️⃣ 启动
app.Run();
// or
await app.RunAsync();
🫧 链式写法
await UpgradeFactory.CreateHttpApp("url").RunAsync();
4️⃣ 服务端配置
HTTP和FTP方式
💠 自动更新接口需要返回如下格式的json内容。服务端可返回大驼峰或小驼峰格式的 JSON,客户端均能兼容。
- Version: ❗[必须] 最新的版本号
- DownloadUrl: ❗[必须] 程序的下载路径
- FileLength: 文件大小,字节
- MinVersion: 程序运行的最低版本号,低于此版本将无法运行
- Log: 更新日志
- CreateTime: 时间
- SignType: 文件校验的签名方式
- SignValue: 文件校验的签名值
{ "Version": "1.2.0", "DownloadUrl": "xxxxx/update.zip", "FileLength": 1887436, "MinVersion": "1.1.0", "Log": "1、修复了若干bug。2、新增了若干需求。", "CreateTime": "2022-01-16 12:12:12", "SignType": "MD5", "SignValue": "f42c6cb229a0a1237c9945448342d59e" }GitHub Release方式- 版本号: 获取
Release的名称 - 程序下载路径: 获取
Release中Assets Name匹配的文件地址
- 版本号: 获取
🔨 高级设置
await UpgradeFactory.CreateHttpApp("url")
.SetUpgrade(builder =>
{
builder.WithTitle("title")
.WithFullPath("fullPath")
.WithIcon("path")
.WithTimeout(60)
.WithBackgroundCheck(true)
.WithSignCheck(true)
.WithTheme(ThemeEnum.System)
.WithLang("zh")
.WithVersionFormat(VersionFormatEnum.MajorMinorBuild);
})
.RunAsync();
🔥 设置标题
setting.WithTitle("title");
🌈 设置应用程序启动路径
setting.WithFullPath("fullPath");
⚡ 设置图标
setting.WithIcon("icon.ico");
🌀 检查更新时的请求超时时间(默认 5 秒)
setting.WithTimeout(60);
🎁 是否在后台进行更新检查(默认为否)
setting.WithBackgroundCheck(true);
⚽ 对下载的文件启用签名校验,支持 MD5 和 SHA1 两种方式(默认为不启用)
setting.WithSignCheck(true);
🎲 设置主题,支持“跟随系统”、“浅色主题”、“深色主题”(默认为跟随系统)
setting.WithTheme(ThemeEnum.System);
// setting.WithTheme(ThemeEnum.Light);
// setting.WithTheme(ThemeEnum.Dark);
💎 设置多语言,支持中文、英文(默认为中文)。
setting.WithLang("zh");
// setting.WithLang("en");
📌 设置版本号显示格式。
setting.WithVersionFormat(VersionFormatEnum.MajorMinorBuildRevision);
// setting.WithVersionFormat(VersionFormatEnum.MajorMinorBuild);
// setting.WithVersionFormat(VersionFormatEnum.MajorMinor);
// setting.WithVersionFormat(VersionFormatEnum.Major);
项目说明
src
├─JiuLing.AutoUpgrade 核心程序
├─JiuLing.AutoUpgrade.Shell 启动程序,用来启动核心更新程序
│ └─Resources 通过动态资源的形式加载核心程序,使得核心程序可以实现自身更新。项目编译前,会先从Librarys.tmp文件夹拷贝核心程序
│ └─JiuLing.AutoUpgrade.exe
├─JiuLing.AutoUpgrade.Shared 核心程序和启动程序所共享的代码片段
├─JiuLing.AutoUpgrade.Test 测试程序
│ ├─JiuLing.AutoUpgrade.Test.csproj
│ ├─UpgradePackage1.2.0.zip
│ └─测试环境配置说明.txt
├─Librarys.tmp 临时目录,核心程序编译完成后将自身发布到该目录
│ └─JiuLing.AutoUpgrade.exe
└─JiuLing.AutoUpgrade.sln 项目解决方案
License
MIT License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. 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 is compatible. 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 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
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.2 | 160 | 6/29/2026 |
| 3.0.0 | 134 | 5/18/2026 |
| 2.3.3 | 157 | 4/17/2026 |
| 2.3.2 | 208 | 1/5/2026 |
| 2.3.1 | 189 | 1/4/2026 |
| 2.3.0 | 623 | 2/10/2025 |
| 2.2.6 | 500 | 9/25/2024 |
| 2.2.5 | 318 | 9/23/2024 |
| 2.2.4 | 306 | 9/23/2024 |
| 2.2.3 | 310 | 9/22/2024 |
| 2.2.2 | 334 | 9/22/2024 |
| 2.2.1 | 307 | 9/22/2024 |
| 2.1.7 | 365 | 9/10/2024 |
| 2.1.6 | 704 | 1/16/2024 |
| 2.1.5 | 615 | 1/4/2024 |
| 2.1.4 | 585 | 1/3/2024 |
| 2.1.3 | 705 | 12/20/2023 |
| 2.1.2 | 747 | 12/8/2023 |
| 2.1.1 | 557 | 11/9/2023 |
| 2.1.0 | 610 | 11/4/2023 |