10

I am developing a client Application(.NET) that should be able to update itself automatically. The application will be deployed using a Simple WiX/MSI Installer.

What i need is:

  • Check server for File versions/hashes/dates
  • Download newer Files
  • update files & relaunch application.

Are there any suitable Frameworks/Patterns to archive this?

I found/tried the following:

  • ClickOnce (does not fit our needs as it is not able to install the application machine wide in the first term)
  • wyUpdate seems to be discontinued
  • ClickThrought seems to be discontinued
  • Google Omaha looks way to complicated for what i try to achive.

Are there any active developed and reliable solutions for this (They do not need to be free nor OpenSource)?

quadroid
  • 8,444
  • 6
  • 49
  • 82
  • You probably won't find something very reliable, partly because it's not that hard to roll your own. In essence all you need to do is publish an RSS feed of versions somewhere and check it for new entries periodically. Wix even includes the functionality as a sample. – Panagiotis Kanavos Sep 08 '14 at 07:20
  • I already expected something like that although i still would prefer a existing solution as this is a very common task i think. Can you link the WiX example? – quadroid Sep 08 '14 at 07:27
  • Why do you say click through is discontinued? Even if it was, it's a good starting point, especially in the Wix environment: https://github.com/wixtoolset/wix4/tree/develop/src/tools/ct – Simon Mourier Sep 09 '14 at 05:58
  • @SimonMourier every link here on SO about ClickThrough i found was dead, and i didn't found anything at Google so i assumed the project was discontinued. I will take a look, thanks – quadroid Sep 09 '14 at 13:32

2 Answers2

2

Maybe the following is helpful:

https://autoupdaterdotnet.codeplex.com/

Or you can give that a try:

https://github.com/synhershko/NAppUpdate

At least these two seem active and easy to use.

S.Spieker
  • 7,005
  • 8
  • 44
  • 50
  • Both does not seem to be very reliable. I Already came across autoupdateerdotnet, but the downloads and dates do not convince me. Althought i will take a look at NAppUpdate – quadroid Sep 08 '14 at 07:12
0

I think that you can code it yourself. like in the code below :
For your Form use the code below :

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

The version.txt should look like this :

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

the upload.php if you will use the php method, should use this code :

<?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];
        }
    }
?>

If you will be using the PHP method you should propably delete it from your Form code, also for the normal method you can upload the version.txt file and update.exe to your dropbox account and use them.
Feel free to ask.

Abdessabour Mtk
  • 3,895
  • 2
  • 14
  • 21