Giter VIP home page Giter VIP logo

fslib.app.simpleupdater's Introduction

SimpleUpdater.NET

简要说明 / Introduction

这是一个快速为已有的应用程序增加自动更新功能的组件,专为 .NET/WinForm 设计,虽然也可以通过命令行模式工作在其它语言中。 WPF将会在稍后支持。

This is a rapid application automatic updater component designed for .NET/WinForm and could be easily integrated into current applications. And it also can work for other applications via command line mode. WPF support is on schedule.

FSLib.App.SimpleUpdater.Updater.CheckUpdateSimple("http://localhost/update_c.xml");

Supports · 支持

  • .NET 2.0
  • .NET 3.0~3.5
  • .NET 4.0~4.8
  • .NET 5.0

特点 / Advantage

  • 通过HTTP传输所有资料 / Using HTTP to perform update
  • 全自动化,几乎不需要额外代码 / Fully automatically, almost no extra codes required
  • 丰富的API接口事件,可定制化 / A large set events and customizable UI
  • 提供打包工具,支持命令行打包 / Update package builder provided, supports build update packages via command line
  • 支持增量升级,减少流量传输成本和时间 / Support delta upgrade, decrease bandwidth and time

基本集成步骤 / Basic steps to integrate

  • Using package builder to build update packages

  • Uploading update packages previously built to your server

  • Add updater assembly SimpleUpdater.dll reference to your project (Nuget package recommended, add fishlee.net.simpleupdater package)

  • Add update call to your Main() function

  • 使用更新包构建工具创建更新包

  • 上传生成的更新包到服务器目录中

  • 在项目中添加 SimpleUpdater.dll 引用 (推荐使用Nuget包引用,搜索 fishlee.net.simpleupdater

  • Main() 函数中添加更新检查调用

发布和支持信息 / Release and Support

软件发布主页 / Offical website https://www.fishlee.net/soft/simple_autoupdater/

使用建议 / Suggestion or Question 可以在 自动更新库知识社区 (推荐)后花园论坛 发帖询问

fslib.app.simpleupdater's People

Contributors

bryant1410 avatar iccfish avatar samzhou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fslib.app.simpleupdater's Issues

用命令行执行打包工具错误

命令行格式:自动更新包生成工具.exe /build [/noui] [/miniui] 文件名
在用命令行执行打包工具的时候,若是用noui指令,在控制台输出是正确的。
4nqa5 xd2pkjurbwz_wty3p

但若是使用miniui,用微型的Form输出进度,就会出现异常。
gk fq7 lcn6 890 ap na2

@iccfish

扩展命令行参数支持

支持命令行参数变更新程序目录、老版本目录、升级包目录,以及是否保存变更

闭关当前程序提示用户体验不够友好

20200423141355
“继续更新” 旁边应该增加个“取消更新”按钮,比如,用户正在操作不好被中断,想取消更新后操作完之后再更新,如果用户点击关闭按钮,此时弹出窗体提示更新发生错误,他以为程序出错了,其实是暂时取消了更新

设置不弹出对话框的设置无效

新版本增加了这个升级失败时弹出一个对话框,我设置了
Updater.Instance.Context.EnableEmbedDialog = false;
但是升级失败(如访问升级服务器失败)时,仍然会弹出对话框。
是否我的用法不对?谢谢

image

.net core项目发布成单文件的问题

程序在启动的时候,检测是否更新,有更新会强制更新,程序启动后有一个手动检测更新,
有更新会使用命令行的形式调用.exe进行更新。
由于两段逻辑是一样,于是将检测的逻辑单独封装成如下代码
但是 .net core的项目发布成单文件的项目,程序启动会报单文件那个错误,而手动检测不会。
是否可以将源码中那个单文件的异常直接关闭?

var updater = FSLib.App.SimpleUpdater.Updater.CreateUpdaterInstance(Config.UpdaterURI);
updater.DownloadUpdateInfoFinished += (e, a) =>
{
updater.Context.EnableEmbedDialog = false;
updater.Context.ForceUpdate = false;
updater.Context.MustUpdate = false;
updater.Context.UpdateInfo.ForceUpdate = false;
updater.Context.UpdateInfo.MustUpdate = false;
};
updater.UpdateError += (e, a) => { };
updater.UpdatesAvailable += (e, a) =>
{
var message = "将升级 {0} (版本 {1}) 到 版本 {2},请等待升级完成。";
var buttons = MessageBoxButtons.OKCancel;
if (!ManualCheckUpdate)
{
message = "将升级 {0} (版本 {1}) 到 版本 {2},请等待升级完成。\r\n\r\n如果无法升级,软件将无法使用。";
buttons = MessageBoxButtons.OK;
}
var dialog = MessageBox.Show(
string.Format(
message,
updater.Context.UpdateInfo.AppName,
updater.Context.CurrentVersion,
updater.Context.UpdateInfo.AppVersion),
"信息",
buttons,
MessageBoxIcon.Information);
if (dialog == DialogResult.OK)
{
StartExternalUpdater();
}
};

是否支持版本回溯

请问是否支持应用版本回退,从高版本回退到低版本,例如目标程序从V1.0升级到V1.1,然后因为某些原因需要回退到V1.0状态

使用自签名SSL证书时,升级包下载失败

当服务端使用了自签名SSL证书时,升级包zip包无法下载,因为自签名证书不受信任,建议忽略证书错误,或者增加个配置项。

相关代码示例如下:

///


/// Together with the AcceptAllCertifications method right
/// below this causes to bypass errors caused by SLL-Errors.
///

public static void IgnoreBadCertificates()
{
System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
}

在网络请求之前调用一次即可,全局生效。
例如可以在Updater 类 void UpdateInternal(object sender, RunworkEventArgs e)中第一行补上调用代码。

相关错误日志如下:
DateTime=2022-06-08T07:13:09.9898762Z
AutoUpdater.exe Information: 0 : 正在初始化 3 个WebClient
DateTime=2022-06-08T07:13:09.9918763Z
AutoUpdater.exe Information: 0 : 包【8DE45295C3779350F5D016F69CE54A79.zip】开始下载
DateTime=2022-06-08T07:13:10.0088773Z
AutoUpdater.exe Information: 0 : 包【0D8F45BE38A74ED2B2CF2F3147E0F7C2.zip】开始下载
DateTime=2022-06-08T07:13:10.2888933Z
AutoUpdater.exe Information: 0 : 包【07B2107DBA38E1B7550CBD400FA2C66D.zip】开始下载
DateTime=2022-06-08T07:13:10.2978938Z
AutoUpdater.exe Warning: 0 : 包【0D8F45BE38A74ED2B2CF2F3147E0F7C2.zip】下载失败:基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系。
DateTime=2022-06-08T07:13:10.5729096Z
AutoUpdater.exe Warning: 0 : 包【8DE45295C3779350F5D016F69CE54A79.zip】下载失败:基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系。
DateTime=2022-06-08T07:13:10.5729096Z
AutoUpdater.exe Warning: 0 : 包【07B2107DBA38E1B7550CBD400FA2C66D.zip】下载失败:基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系。

更新文件时卡死

引发的异常:“System.ObjectDisposedException”(位于 System.Data.SQLite.dll 中)
程序“[14120] PreAudit.exe”已退出,返回值为 -1 (0xffffffff)。

下载完文件,开始解压替换时候卡死

取消

没事了,是我自己的原因

部分界面文字有误,部分文字可优化

1.下面截图的提示可以再优化,比如,生成之前清理目标目录,弹出提示文字在此项选中的时候应该提示清空目录之类的文字
20200421165137

2.最近版本等文字描述变量反了
20200421165147

3.更新后执行 tip文字描述有误,应该是“更新后执行”而不是“更新前执行”
20200421165156

项目使用Costura会导致更新程序报错

Costura会将SimpleUpdater.dll一起打包,启动后会报路径的形式不合法,
需要在FodyWeavers.xml中的Costura节点添加将SimpleUpdater.dll排除后才能正常使用

<Costura> <ExcludeAssemblies> SimpleUpdater </ExcludeAssemblies> </Costura>

更新说明文件绑定问题

一个项目绑定更新文件保存后,再点击打开另外一个已保存的项目的时候,绑定文件没变化,还是第一个项目保存的绑定文件

windows XP 不支持 tls1.2

我查了好多的文章, 也试了很多种方法, windows xp 就是不支持TLS1.2 的, 你的最新的程序好像是需要这个的, 要不然就下面的错误, 在windows 7 中安装完.net 4.5 的就没有这样的问题. 用以前的 FSLib.App.SimpleUpdater-4.3.0.0 也是没有问题的, 在xp 下也能用. 希望能帮忙解决一下这个问题, 或者在新的源码中的哪个地方设置一下, 可以不用依赖 TLS1.2 ? 谢谢

image

执行更新报错

图片
有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。

************** 异常文本 **************
System.ComponentModel.Win32Exception (0x80004005): 系统找不到指定的文件。
在 System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
在 System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
在 FSLib.App.SimpleUpdater.Updater.CleanTemp()
在 FSLib.App.SimpleUpdater.Updater.OnUpdateCancelled()
在 FSLib.App.SimpleUpdater.Updater.CopyAndStartUpdater(String[] ownerProcessList)
在 FSLib.App.SimpleUpdater.Updater.StartExternalUpdater(String[] ownerProcess)
在 FSLib.App.SimpleUpdater.Dialogs.UpdateFound.btnUpdate_Click(Object sender, EventArgs e)
在 System.Windows.Forms.Control.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
在 System.Windows.Forms.Button.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** 已加载的程序集 **************
mscorlib
程序集版本:4.0.0.0
Win32 版本:4.8.4526.0 built by: NET48REL1LAST_B
基本代码:file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

restart
程序集版本:1.0.0.0
Win32 版本:1.0.1.0
基本代码:file:///C:/Release/restart.exe

System.Windows.Forms
程序集版本:4.0.0.0
Win32 版本:4.8.4526.0 built by: NET48REL1LAST_B
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System
程序集版本:4.0.0.0
Win32 版本:4.8.4545.0 built by: NET48REL1LAST_B
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Drawing
程序集版本:4.0.0.0
Win32 版本:4.8.4395.0 built by: NET48REL1LAST_B
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

SimpleUpdater
程序集版本:5.1.0.0
Win32 版本:5.1.0.0
基本代码:file:///C:/Release/SimpleUpdater.DLL

System.Configuration
程序集版本:4.0.0.0
Win32 版本:4.8.4190.0 built by: NET48REL1LAST_B
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Core
程序集版本:4.0.0.0
Win32 版本:4.8.4545.0 built by: NET48REL1LAST_B
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Xml
程序集版本:4.0.0.0
Win32 版本:4.8.3761.0 built by: NET48REL1
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

System.ServiceProcess
程序集版本:4.0.0.0
Win32 版本:4.8.3761.0 built by: NET48REL1
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.ServiceProcess/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll

System.Windows.Forms.resources
程序集版本:4.0.0.0
Win32 版本:4.8.3761.0 built by: NET48REL1
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/System.Windows.Forms.resources.dll

restart.resources
程序集版本:1.0.0.0
Win32 版本:1.0.1.0
基本代码:file:///C:/Release/zh-CN/restart.resources.DLL

Microsoft.GeneratedCode
程序集版本:1.0.0.0
Win32 版本:4.8.3761.0 built by: NET48REL1
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

Newtonsoft.Json
程序集版本:13.0.0.0
Win32 版本:13.0.2.27524
基本代码:file:///C:/Release/Newtonsoft.Json.DLL

mscorlib.resources
程序集版本:4.0.0.0
Win32 版本:4.8.3761.0 built by: NET48REL1
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/mscorlib.resources.dll

System.Numerics
程序集版本:4.0.0.0
Win32 版本:4.8.3761.0 built by: NET48REL1
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll

System.Runtime.Serialization
程序集版本:4.0.0.0
Win32 版本:4.8.4545.0 built by: NET48REL1LAST_B
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll

System.Data
程序集版本:4.0.0.0
Win32 版本:4.8.4545.0 built by: NET48REL1LAST_B
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll

TimeCrontab
程序集版本:3.3.3.0
Win32 版本:3.3.3.0
基本代码:file:///C:/Release/TimeCrontab.DLL

Microsoft.GeneratedCode
程序集版本:1.0.0.0
Win32 版本:4.8.3761.0 built by: NET48REL1
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

Microsoft.GeneratedCode
程序集版本:1.0.0.0
Win32 版本:4.8.3761.0 built by: NET48REL1
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

System.resources
程序集版本:4.0.0.0
Win32 版本:4.8.3761.0 built by: NET48REL1
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/System.resources.dll

************** JIT 调试 **************
要启用实时(JIT)调试,
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
jitDebugging 值。
编译应用程序时还必须启用
调试。

例如:

启用 JIT 调试后,任何未经处理的异常
都将被发送到在此计算机上注册的 JIT 调试程序,
而不是由此对话框处理。

升级包创建工具修复提议

升级包创建工具中,基本信息标签页里,更新前执行若有一次保存过后,重新打开项目后,会留下这个节点未清除,然后报错系统找不到指定的文件,除非重新选择一次未选择就会去除

增加生成后远程上传功能

添加接口,允许在生成后远程上传到指定服务器上,通过HTTP接口或FTP接口。

  • FTP上传
  • WEB上传
  • 自定义程序上传

FTP上传


  • 上传前清空文件

WEB上传


  • WEB上传钩子(上传前、上传后)

如何达到完全同步的状态

从nuget获取的4.3版本
使用如下地址 https://www.nuget.org/packages/fishlee.net.simpleupdater/4.3.0?_src=template
自动更新包生成工具4.3.0.0
打包配置

<?xml version="1.0"?>
<AuProject xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <UpdateInfo>
    <AppName>Test</AppName>
    <AppVersion>4.3.0.0</AppVersion>
    <ExecuteTimeout>0</ExecuteTimeout>
    <TreatErrorAsNotUpdated>false</TreatErrorAsNotUpdated>
    <PromptUserBeforeAutomaticUpgrade>true</PromptUserBeforeAutomaticUpgrade>
    <AutoCloseSucceedWindow>true</AutoCloseSucceedWindow>
    <DeleteMethod>None</DeleteMethod>
    <PackageSize>0</PackageSize>
    <ForceUpdate>false</ForceUpdate>
    <Packages />
    <HideBeforeExecuteWindow>false</HideBeforeExecuteWindow>
    <HideAfterExecuteWindow>false</HideAfterExecuteWindow>
    <MustUpdate>false</MustUpdate>
    <AutoExitCurrentProcess>false</AutoExitCurrentProcess>
    <AutoEndProcessesWithinAppDir>true</AutoEndProcessesWithinAppDir>
    <AutoKillProcesses>false</AutoKillProcesses>
    <RequreAdminstrorPrivilege>false</RequreAdminstrorPrivilege>
  </UpdateInfo>
  <DefaultFileVerificationLevel>Size Hash</DefaultFileVerificationLevel>
  <DefaultUpdateMethod>VersionCompare</DefaultUpdateMethod>
  <Files />
  <ApplicationDirectory>Test</ApplicationDirectory>
  <DestinationDirectory>Update</DestinationDirectory>
  <CreateCompatiblePackage>false</CreateCompatiblePackage>
  <CompressPackage>true</CompressPackage>
  <EnableIncreaseUpdate>true</EnableIncreaseUpdate>
  <VersionUpdateSrc>Test\Test.exe</VersionUpdateSrc>
  <PackageExtension>zip</PackageExtension>
  <UseRandomPackageNaming>true</UseRandomPackageNaming>
  <CleanBeforeBuild>true</CleanBeforeBuild>
  <ComponentFlags />
</AuProject>

举例
版本1: filea fileb filec
版本2: filea filed
更新版本2后,本地有了 filea fileb filec filed
想要的效果是 本地只有 filea filed

弹出多个升级提示窗口

用最简单的整合方式做的
var updater = App.SimpleUpdater.Updater.CheckUpdateSimple(UpdateUrl, "update_c.xml");
但是会弹出3个提示升级的窗口出来

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.