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

Unable to create Shortcuts #396

Closed
st1pps opened this issue Jul 23, 2015 · 3 comments
Closed

Unable to create Shortcuts #396

st1pps opened this issue Jul 23, 2015 · 3 comments

Comments

@st1pps
Copy link

st1pps commented Jul 23, 2015

Hi,

I am working on a small C#/WPF application. As the project contains multipe EXE files, of which only one is thought to be executed by the user, I have chosen to use the "SquirrelAwareVersion" approach.
The updates get installed without problems. My only problem is that no shortcuts are generated.

I'm using the code below:

private async Task Update()
        {
            using (var mgr = new UpdateManager("\\\\PLMX01\\Freigaben\\Software\\Navvy\\updates"))
            {
                SquirrelAwareApp.HandleEvents(
                    onInitialInstall: v => OnInitialInstall(mgr),
                    onAppUpdate: v => OnAppUpdate(mgr),
                    onAppUninstall: v => OnAppUninstall(mgr));
                var updateInfo = await mgr.CheckForUpdate();
                if (updateInfo == null || !updateInfo.ReleasesToApply.Any())
                {
                    return;
                }
                this.events.GetEvent<UiMessageEvent>().Publish(new UiMessage($"Downloading new Version: {updateInfo.FutureReleaseEntry.Version}", UiMessage.Severity.Info));
                var releases = updateInfo.ReleasesToApply;
                await mgr.DownloadReleases(releases);
                this.events.GetEvent<UiMessageEvent>().Publish(new UiMessage("Applying update", UiMessage.Severity.Info));
                await mgr.ApplyReleases(updateInfo);
            }
        }

        private void OnInitialInstall(UpdateManager mgr)
        {
            mgr.CreateShortcutForThisExe();
            mgr.CreateShortcutsForExecutable("Navvy.Desktop.exe", ShortcutLocation.Desktop, false);
            mgr.CreateShortcutsForExecutable("Navvy.Desktop.exe", ShortcutLocation.StartMenu, false);
            mgr.CreateUninstallerRegistryEntry();
        }

        private void OnAppUpdate(UpdateManager mgr)
        {
            mgr.CreateShortcutsForExecutable("Navvy.Desktop.exe", ShortcutLocation.Desktop, true);
            mgr.CreateShortcutsForExecutable("Navvy.Desktop.exe", ShortcutLocation.StartMenu, true);
            mgr.RemoveUninstallerRegistryEntry();
            mgr.CreateUninstallerRegistryEntry();
        }

        private void OnAppUninstall(UpdateManager mgr)
        {
            mgr.RemoveShortcutsForExecutable("Navvy.Desktop.exe", ShortcutLocation.Desktop);
            mgr.RemoveShortcutsForExecutable("Navvy.Desktop.exe", ShortcutLocation.StartMenu);
            mgr.RemoveUninstallerRegistryEntry();
        }

I've tried it on Windows 10 RTM, Win7 and Win8.1. This part of the Squirrel log seems to be related:

2015-07-23 12:30:03> ApplyReleasesImpl: Processing shortcut ''
2015-07-23 12:30:03> ApplyReleasesImpl: Does not match 'C:\Users\f.stipps.PSE\AppData\Local\Navvy\app-1.30.0', continuing to next directory
2015-07-23 12:30:03> ApplyReleasesImpl: Processing shortcut 'C:\Program Files\Waterfox\waterfox.exe'
2015-07-23 12:30:03> ApplyReleasesImpl: Does not match 'C:\Users\f.stipps.PSE\AppData\Local\Navvy\app-1.30.0', continuing to next directory

Can anyone give me some advice how to find out what is going wrong?

@anaisbetts
Copy link
Contributor

This part of the Squirrel log seems to be related:

This is related to shortcut pinning, you can ignore this

Can anyone give me some advice how to find out what is going wrong?

I'd debug through CreateShortcutsForExecutable or just execute your app with --squirrel-install 1.0.0 and see if it blows up

@st1pps
Copy link
Author

st1pps commented Jul 23, 2015

Thanks for your reply. I just ran the app with the argument you proposed, and it created the shortcuts promptly. When installing the first time via Setup.exe it does not work though.

@anaisbetts
Copy link
Contributor

Oh wait, you did not follow instructions:

 SquirrelAwareApp.HandleEvents(
                    onInitialInstall: v => OnInitialInstall(mgr),
                    onAppUpdate: v => OnAppUpdate(mgr),
                    onAppUninstall: v => OnAppUninstall(mgr));

Update: You did follow instructions, they are wrong :-/. This call to HandleEvents needs to be as early as possible in startup for your app, not in your app's "Update" method

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