Squirrel.Windows icon indicating copy to clipboard operation
Squirrel.Windows copied to clipboard

UpdateManager.GitHubUpdateManager Not Updateing

Open manbeardgames opened this issue 10 years ago • 2 comments

I have tried multiple way of using the GitHubUpdateManager to update the application, and both have not worked at all. The first method I used was the one straight from the example documentation at

https://github.com/Squirrel/Squirrel.Windows/blob/master/docs/using/github.md

When using that, this was the App.xaml.cs code

public partial class App : Application
{
    protected override async void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);

             using (var mgr = UpdateManager.GitHubUpdateManager("https://github.com/dartvalince/DiscerningEye/"))
             {
                 await mgr.Result.UpdateApp();
             }


        //  Check for updats to the alarm data file
        this.UpdateAlarmData();

        var bs = new Bootstrapper();
        bs.Run();

        DiscerningEye.App.Current.Exit += Current_Exit;

        DiscerningEye.Properties.Settings.Default.PropertyChanged += Default_PropertyChanged;

        //  Apply startup theme from users saved settings
        ChangeApplicationTheme();

    }

When using this i went through all the steps in the documentation

  • Commit
  • Create .nupkg
  • releasify
  • Create new release on GItHub adding all the files from the Releases folder

After this, I wen through the use case a user would and downloaded the files from the GitHub release and ran the Setup.exe. It installed the application correctly, placing items in the Start Menu, on the Desktop, and in the local %appdata% folder, however, the application did not start. I checked the processes running in Task Manager, and it showed the process running as a Background Process, with 0% CPU and 0% Network and ~7MB of memory.

I figured the problem with this was that the await command was not releasing control back to the OnStartup method. So I then adjusted the App.xaml.cs to the following

public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {


        base.OnStartup(e);

        Task.Run(async () =>
         {
             using (var mgr = UpdateManager.GitHubUpdateManager("https://github.com/dartvalince/DiscerningEye/"))
             {
                 await mgr.Result.UpdateApp();
             }
         });


        //  Check for updats to the alarm data file
        this.UpdateAlarmData();

        var bs = new Bootstrapper();
        bs.Run();

        DiscerningEye.App.Current.Exit += Current_Exit;

        DiscerningEye.Properties.Settings.Default.PropertyChanged += Default_PropertyChanged;

        //  Apply startup theme from users saved settings
        ChangeApplicationTheme();

    }

This pushes the update onto a seperate thread an allows the OnStartup method to complete. Once again, i went through the normal process as described in the documentation

  • Commit
  • Create .nupkg (correct version number used)
  • releasify
  • Create new release on GItHub adding all the files from the Releases folder

At this point, i once again downloaded the files from the release, and ran the Setup.exe. This time, after doing the normal install process, the application opened. So I went to my source code, updated the Assembly Version by 1, then went through the process

  • Commit
  • Create .nupkg (correct version number used, double and triple checked)
  • releasify
  • Create new release on GItHub adding all the files from the Releases folder

Now, I have a release on GitHub that is tagged 1 version higher, with the new Releases folder files as the assests and this is tagged by GitHub as the latest release.. As a normal user would, i then opened the application using the shortcut on the desktop. At this point, i would assume that the GitHubUpdateManager would do the necessaries to download the update and prepare it for the next time the user opens the application. However, no update is ever downloaded.

I checked the local %appdata% folder for the application, and nothing is being placed in there for the new version. I closed and reopened the application and watched the processes and notice that the Background Process opens for a few seconds, then the main process starts. However a the new version from the latest release is never downloaded.

Is there something I've done wrong? Is this bugged? I'm losing my mind over this. Any help would be greatly appreciated.

manbeardgames avatar Mar 25 '16 19:03 manbeardgames

This can be closed, got it working, it was a user issue.

The URL to use for the GitHubUpdateManger cannot end with a /. I originally had

https://github.com/dartvalince/DiscerningEye/

had to change it to

https://github.com/dartvalince/DiscerningEye (without the ending /)

I put a try/catch around the update and had the catch use a MessageBox to show the error messages, which was that the resource could not be found: 404 error. This is what prompted me to remove the / and try again.

manbeardgames avatar Mar 25 '16 20:03 manbeardgames

Thanks! I'll add a note on the doc section.

kenbailey avatar Mar 26 '16 05:03 kenbailey