自动更新框架/引擎

问题描述:

我正在开发一个应该能够自动更新自己的客户端应用程序(.NET)。 应用程序将使用简单的WiX/MSI安装程序进行部署。自动更新框架/引擎

我需要的是:

  • 的文件版本/散列检查服务器/日期
  • 下载更新文件
  • 更新文件&重新推出应用程序。

是否有任何合适的框架/模式来存档?

我发现/试过如下:

  • 的ClickOnce(不适合我们的需要,因为它是不能够广泛安装应用程序的机器中的第一项)
  • wyUpdate似乎停止
  • ClickThrought似乎已停产
  • 谷歌奥马哈看起来很复杂,我试图达到目的。

是否有任何积极的开发和可靠的解决方案(他们不需要是免费的,也不需要OpenSource)?

+0

你可能不会找到非常可靠的东西,部分原因是因为它不是很难推出自己的东西。实质上,您需要做的是发布某个版本的RSS源,并定期检查新条目。 Wix甚至包括作为示例的功能。 – 2014-09-08 07:20:41

+0

我已经期待这样的事情,虽然我仍然更喜欢现有的解决方案,因为这是我认为的一个非常常见的任务。你能链接WiX例子吗? – Console 2014-09-08 07:27:27

+0

你为什么说点击通过停止?即使是这样,这是一个很好的起点,尤其是在Wix环境中:https://github.com/wixtoolset/wix4/tree/develop/src/tools/ct – 2014-09-09 05:58:44

也许下面是有帮助的:

https://autoupdaterdotnet.codeplex.com/

或者你可以给一个尝试:

https://github.com/synhershko/NAppUpdate

至少这两个看似活跃,易于使用。

+0

两者似乎都不是很可靠。我已经遇到autoupdateerdotnet,但下载和日期并不能说服我。虽然我会看看NAppUpdate – Console 2014-09-08 07:12:45

我认为你可以自己编码。就像下面的代码:
为了您Form使用下面的代码:

Imports System.Net 

Public Class frmMain 
    Private WithEvents WebC As New WebClient 
    Private updatefilename As String 
    Private WithEvents updateTimer As New Timer With {.Enabled = True, .Interval = 300000} '300000 is 5 min 

    Private Sub frmMain_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load 
     CheckUpdatePHP() ' you can use the php method or the normal method 
    End Sub 

    Private Sub CheckUpdatePHP() Handles updateTimer.Tick 
     Dim ServerVer As String = WebC.DownloadString("http://yourdomainname.com/update.php?get=ver") 
     If Not Application.ProductVersion.Equals(ServerVer) Then 
      Dim updateURL As String = WebC.DownloadString("http://yourdomainname.com/update.php?get=url") 
      updatefilename = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".exe" 
      WebC.DownloadFileAsync(New Uri(updateURL), updatefilename) 
     End If 
    End Sub 

    Private Sub CheckUpdate() 'Handles updateTimer.Tick 
     Dim ServerInfo As String = WebC.DownloadString("http://yourdomainname.com/version.txt") 
     Dim Infos As String() = ServerInfo.Split("%split%") 
     If Not Application.ProductVersion.Equals(Infos(0)) Then 
      Dim updateURL As String = WebC.DownloadString(Infos(1)) 
      updatefilename = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".exe" 
      WebC.DownloadFileAsync(New Uri(updateURL), updatefilename) 
     End If 
    End Sub 

    Private Sub WebC_DownloadFileCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs) Handles WebC.DownloadFileCompleted 
     Dim pinfo As New ProcessStartInfo(updatefilename) 
     pinfo.WindowStyle = ProcessWindowStyle.Hidden 
     pinfo.CreateNoWindow = True 
     Process.Start(pinfo) 
     End 
    End Sub 
End Class 

version.txt应该是这样的:

1.0.0.0%split%http://yourdomainname.com/update.exe 

upload.php如果你使用PHP的方法,应该使用这种代码:

<?php 
    if(isset($_GET['get'])){ 
     $get = $_GET['get']; 
     $txt = file_GET_contents("version.txt"); 
     $info = explode("%split%",$txt); 
     if($get = 'ver'){ 
      echo $info[0]; 
     }elseif($get = 'url'){ 
      echo $info[1]; 
     } 
    } 
?> 

如果您将使用PHP method you shoul d可以从表格代码中删除它,也可以使用常规方法将version.txt文件和update.exe上传到您的保管箱帐户并使用它们。
随意问。

+0

谢谢你,我知道更新本身是一项基本任务,但我认为在细节(安全/错误处理/认证)方面存在很多缺陷。 – Console 2014-09-15 08:03:09

+0

您可以通过简单编码添加这些功能。 – user3980820 2014-09-15 11:34:15