Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UpdateManager.GitHubUpdateManager Not Updateing #641

Closed
manbeardgames opened this issue Mar 25, 2016 · 2 comments
Closed

UpdateManager.GitHubUpdateManager Not Updateing #641

manbeardgames opened this issue Mar 25, 2016 · 2 comments

Comments

@manbeardgames
Copy link

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
Copy link
Author

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.

@kenbailey
Copy link
Contributor

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

kenbailey pushed a commit to kenbailey/Squirrel.Windows that referenced this issue Mar 26, 2016
kenbailey pushed a commit to kenbailey/Squirrel.Windows that referenced this issue Mar 26, 2016
anaisbetts added a commit that referenced this issue Mar 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants