GeneralUpdate是一款基于.NET Standard2.0开源跨平台自动升级组件。支持大部分现有的桌面客户端实现技术和.NET框架,也可以无UI运行。
在线文档地址:https://www.justerzhu.cn/
源码仓库:https://github.com/GeneralLibrary/GeneralUpdate
示例仓库:https://github.com/GeneralLibrary/GeneralUpdate-Samples
在Github上下载Sample仓库,使用示例前请确保本地安装了.NET 8的运行环境。
仓库目录内容如下:
名称 | 说明 |
---|---|
Client | 主客户端示例程序 |
Server | 服务端示例程序 |
StartManager | 更新流程控制台 |
Upgrade | 升级端示例程序 |
process.bat | 无需关注 |
resource.bat | 无需关注 |
start.cmd | 启动更新示例的脚本,一切从它开始 |
找到文件目录,并双击(每次启动start.cmd脚本都会重置本地目录所以无需手动管理文件目录):
...\GeneralUpdate-Samples\src\start.cmd
如下图所示,自动开始编译并拷贝所有相关项目的bin目录到app目录下:
...\GeneralUpdate-Samples\src\run\app
这时候就会出现StartManager.exe的界面,所有的选项均为字面意思,我们先别着急输入1这时候先看看app目录更新之前的装备后续方便我们验证更新结果。
我们进入到app目录之后,可以看到这是没有升级之前的目录。
检查完app目录之后:
看到主客户端程序自动关闭,我们再去检查一下run\app目录。会发现多了一个备份目录“app-1.0.0.0”和一个“Congratulations on the update.txt”。
看到这里代表您已经成功的完成了一次升级,Congratulations!
以下示例定义方法,包含Bowl使用。
var installPath = AppDomain.CurrentDomain.BaseDirectory;
var lastVersion = "1.0.0.3";
var processInfo = new MonitorParameter
{
ProcessNameOrId = "JsonTest.exe",
DumpFileName = $"{lastVersion}_fail.dmp",
FailFileName = $"{lastVersion}_fail.json",
TargetPath = installPath,
FailDirectory = Path.Combine(installPath, "fail", lastVersion),
BackupDirectory = Path.Combine(installPath, lastVersion),
WorkModel = "Normal"
};
Bowl.Launch(processInfo);
如果监控到崩溃闪退将会在运行目录下生成:
导出到“fail”目录下并根据版本号区分文件夹。
{
"Parameter": {
"TargetPath": "D:\\github_project\\GeneralUpdate\\src\\c#\\Generalupdate.CatBowl\\bin\\Debug\\net9.0\\",
"FailDirectory": "D:\\github_project\\GeneralUpdate\\src\\c#\\Generalupdate.CatBowl\\bin\\Debug\\net9.0\\fail\\1.0.0.3",
"BackupDirectory": "D:\\github_project\\GeneralUpdate\\src\\c#\\Generalupdate.CatBowl\\bin\\Debug\\net9.0\\1.0.0.3",
"ProcessNameOrId": "JsonTest.exe",
"DumpFileName": "1.0.0.3_fail.dmp",
"FailFileName": "1.0.0.3_fail.json",
"WorkModel": "Normal",
"ExtendedField": null
},
"ProcdumpOutPutLines": [
"ProcDump v11.0 - Sysinternals process dump utility",
"Copyright (C) 2009-2022 Mark Russinovich and Andrew Richards",
"Sysinternals - www.sysinternals.com",
"Process: JsonTest.exe (19712)",
"Process image: D:\\github_project\\GeneralUpdate\\src\\c#\\Generalupdate.CatBowl\\bin\\Debug\\net9.0\\JsonTest.exe", "CPU threshold: n/a",
"Performance counter: n/a", "Commit threshold: n/a",
"Threshold seconds: n/a", "Hung window check: Disabled", "Log debug strings: Disabled",
"Exception monitor: Unhandled", "Exception filter: [Includes]",
" *",
" [Excludes]",
"Terminate monitor: Disabled",
"Cloning type: Disabled",
"Concurrent limit: n/a",
"Avoid outage: n/a",
"Number of dumps: 1",
"Dump folder: D:\\github_project\\GeneralUpdate\\src\\c#\\Generalupdate.CatBowl\\bin\\Debug\\net9.0\\fail\\1.0.0.3\\",
"Dump filename/mask: 1.0.0.3_fail",
"Queue to WER: Disabled", "Kill after dump: Disabled",
"Press Ctrl-C to end monitoring without terminating the process.",
"[19:05:23] Exception: E0434352.CLR", "[19:05:23] Unhandled: E0434352.CLR",
"[19:05:23] Dump 1 initiated: D:\\github_project\\GeneralUpdate\\src\\c#\\Generalupdate.CatBowl\\bin\\Debug\\net9.0\\fail\\1.0.0.3\\1.0.0.3_fail.dmp",
"[19:05:23] Dump 1 writing: Estimated dump file size is 62 MB.",
"[19:05:23] Dump 1 complete: 62 MB written in 0.1 seconds",
"[19:05:23] Dump count reached."]
}
模块名 显示名称 描述 驱动程序类型 启动模式 状态 状态 接受停止 接受暂停 分页缓冲池 代码(字节) BSS(字 链接日期 路径 Init(字节)
============ ====================== ====================== ============= ========== ========== ========== =========== ============ ========== ========== ======= ====================== ================================================ ==========
360AntiAttac 360Safe Anti Attack Se 360Safe Anti Attack Se Kernel System Running OK TRUE FALSE 4,096 36,864 0 9/29/2022 3:45:03 PM C:\Windows\system32\Drivers\360AntiAttack64.sys 4,096
360AntiHacke 360Safe Anti Hacker Se 360Safe Anti Hacker Se Kernel System Running OK TRUE FALSE 4,096 139,264 0 11/27/2023 3:43:37 PM C:\Windows\system32\Drivers\360AntiHacker64.sys 8,192
360AntiHijac 360Safe Anti Hijack Se 360Safe Anti Hijack Se Kernel System Running OK TRUE FALSE 4,096 73,728 0 5/8/2024 12:19:52 PM C:\Windows\system32\Drivers\360AntiHijack64.sys 4,096
360AntiSteal 360Safe Anti Steal Fil 360Safe Anti Steal Fil Kernel System Running OK TRUE FALSE 4,096 20,480 0 4/18/2024 3:58:04 PM C:\Windows\system32\Drivers\360AntiSteal64.sys 8,192
360Box64 360Box mini-filter dri 360Box mini-filter dri File System System Running OK TRUE FALSE 0 225,280 0 8/7/2024 11:50:19 AM C:\Windows\system32\DRIVERS\360Box64.sys 12,288
//...
主机名: ****
OS 名称: Microsoft Windows 11 专业版
OS 版本: 10.0.2*** Build 22***
OS 制造商: Microsoft Corporation
OS 配置: 独立工作站
OS 构建类型: Multiprocessor Free
注册的所有人: ****@outlook.com
注册的组织:
产品 ID: ****-80000-***00-A****
初始安装日期: 11/16/2023, 9:56:28 PM
系统启动时间: 11/26/2024, 9:37:51 PM
系统制造商: ASUS
系统型号: System Product Name
系统类型: x64-based PC
处理器: 安装了 1 个处理器。
[01]: Intel** Family * Model *** Stepping * GenuineIntel ~**** Mhz
BIOS 版本: American Megatrends Inc. 1402, 4/1/2022
Windows 目录: C:\Windows
系统目录: C:\Windows\system32
启动设备: \Device\Ha*****olume1
系统区域设置: zh-cn;中文(中国)
输入法区域设置: zh-cn;中文(中国)
时区: (UTC+08:00) **,**,*******,****
物理内存总量: 16,194 MB
可用的物理内存: 1,795 MB
虚拟内存: 最大值: 25,410 MB
虚拟内存: 可用: 9,438 MB
虚拟内存: 使用中: 15,972 MB
页面文件位置: D:\****file.sys
域: WORKGROUP
登录服务器: \\****
修补程序: 安装了 6 个修补程序。
[01]: KB504****
[02]: KB502****
[03]: KB503****
[04]: KB503****
[05]: KB504****
[06]: KB504****
网卡: 安装了 3 个 NIC。
[01]: Intel(R) Ethernet Connection (**) I***-V
连接名: 以太网
启用 DHCP: 是
DHCP 服务器: 192.168.**.**
IP 地址
[01]: 192.168.**.**
[02]: ***::2640:***:****:****
[02]: VMware Virtual Ethernet Adapter for VMnet1
连接名: VMware Network Adapter VMnet1
启用 DHCP: 是
DHCP 服务器: 192.168.**.**
IP 地址
[01]: 192.168.**.**
[02]: ***::9b3:***,***:****
[03]: VMware Virtual Ethernet Adapter for VMnet8
连接名: VMware Network Adapter VMnet8
启用 DHCP: 是
DHCP 服务器: 192.168.**.**
IP 地址
[01]: 192.***,***:****
[02]: fe80::***:***:***:****
Hyper-V 要求: 已检测到虚拟机监控程序。将不显示 Hyper-V 所需的功能。
//...
该项目提供补丁包管理、补丁包制作、产品线、分组、客户端、升级验证、更新版本推送、升级状态追踪等能力,帮助企业更好管理升级体系。(本项目全线使用Semi.Avalonia开源控件库实现,且均支持AOT)