AttnSoft.AutoUpdate
3.3.3
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.6.1
This package targets .NET Framework 4.6.1. The package is compatible with this framework or higher.
dotnet add package AttnSoft.AutoUpdate --version 3.3.3
NuGet\Install-Package AttnSoft.AutoUpdate -Version 3.3.3
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="AttnSoft.AutoUpdate" Version="3.3.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AttnSoft.AutoUpdate" Version="3.3.3" />
<PackageReference Include="AttnSoft.AutoUpdate" />
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 AttnSoft.AutoUpdate --version 3.3.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AttnSoft.AutoUpdate, 3.3.3"
#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 AttnSoft.AutoUpdate@3.3.3
#: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=AttnSoft.AutoUpdate&version=3.3.3
#tool nuget:?package=AttnSoft.AutoUpdate&version=3.3.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AttnSoft.AutoUpdate
AttnSoft.AutoUpdate 是一款轻量级、易于使用、跨平台的应用程序自动升级组件。
快速开始
客户端使用
Windows环境
在您的主项目中安装AttnSoft.AutoUpdate NuGet包,根据需要按照如下示例代码配置即可
示例代码:
- 系统默认为OSS方式获取版本信息:
UpdateContext? context = new UpdateContext()
{
UpdateUrl = "http://update.attnsoft.com/demo/v1/version.json"
};
await UpdateApp.CreateBuilder(context).StartUpdateAsync();
- 启用WebApi方式获取版本信息:
UpdateContext? context = new UpdateContext()
{
UpdateUrl = "http://127.0.0.1:5000/Verification"
};
context.UseWebApi();
await UpdateApp.CreateBuilder(context).StartUpdateAsync();
升级组件内部会向UpdateUrl发送Post请求,获得版本信息.
- 自定义方式获取版本信息:
UpdateContext? context = new UpdateContext()
{
UpdateUrl = "http://127.0.0.1:5000/Verification"
};
context.UseWebApi();
context.OnGetUpdateVersionInfo += (context) =>
{
var uri = new Uri(context.UpdateUrl);
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization =
new System.Net.Http.Headers.AuthenticationHeaderValue("Authorization", "tokenxxx");
string postData = $"{{\"Version\": \"{context.ClientVersion}\", \"AppKey\": \"{context.AppSecretKey}\"}}";
var stringContent = new StringContent(postData, Encoding.UTF8, "application/json");
var result = await httpClient.PostAsync(uri, stringContent);
var responseJsonStr = await result.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<List<VersionInfo>>(responseJsonStr);
};
await UpdateApp.CreateBuilder(context).StartUpdateAsync();
Linux环境
请使用源码编译方式:
git clone https://github.com/liaiwu/AttnSoft.AutoUpdate.git
- 编译AttnSoft.AutoUpdate并在主项目中引用
- 编译AttnSoft.Upgrade项目。 根据具体使用环境选择相应的linux平台,并将生成的Upgrade可执行文件与主程序放到同一个目录下。
- 代码使用与上述Windows环境一致
服务端配置
本组件支持两种存储版本信息的方式:
- OSS:在文件服务器(对象存储服务)上配置Version.json文件,用来描述发布的版本信息.
- WebApi:组件通过Web服务的方式获取版本信息.
以上两种方式提供的版本信息都是json格式的,具体内容如下:
[
{
"recordId": 1,
"version": "1.0.0.0",
"requiredMinVersion": "",
"url": "http://update.attnsoft.com/demo/v1/WinAppClient.zip",
"hash": "SHA256",
"startAppCmd": "WinAppClient",
"isForcibly": false,
"desc": "Introduction to the new version features.",
"releaseDate": "2025-01-15T09:23:19",
"updateLogUrl": null,
"blackFileFormats": [ ".patch", ".zip", ".rar", ".tar", ".pdb" ],
"blackFiles": [],
"skipDirectorys": [ "app-", "fail" ]
}
]
补丁包制作
可以根据补丁包的大小选择如下两种方式:
- 全量更新: 如果补丁包不大的话,可以直接将要更新的文件用压缩工具生成单一ZIP格式的文件即可。
- 差异更新: 如果补丁包很大的话,可以采用差异更新方式制作补丁包以减少补丁包的大小。 可以使用GeneralUpdate提供的工具包制作。
支持框架
.NET框架名称 | 是否支持 |
---|---|
.NET Framework 4.6.1 | 支持 |
.NET Core 2.0 、3.1 | 支持 |
.NET 5 to last version | 支持 |
感谢
项目中GeneralUpdate命名空间下的代码均来源于GeneralUpdate项目。非常感谢GeneralUpdate团队的开源贡献。
Product | Versions 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. net6.0-windows7.0 is compatible. 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. 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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.1
- Newtonsoft.Json (>= 13.0.3)
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- System.Text.Encoding.CodePages (>= 9.0.0)
- System.Text.Json (>= 9.0.0)
-
net6.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- System.Text.Json (>= 9.0.0)
-
net6.0-windows7.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- System.Text.Json (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
A lightweight, easy-to-use, cross-platform application for automatically updating components.一款轻量级、易于使用、跨平台的应用程序自动升级组件