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

Start menu shortcuts disappearing after applying updates

Open olabacker opened this issue 4 years ago • 6 comments
trafficstars

Squirrel version(s) 2.0.1

Description I am attempting to integrate Squirrel to a winforms application. While applying a new version the application shortcuts in the start menu seems to disappear. I'm wondering where I should check to resolve this issue.. Is it something corrupt with the nupkg, something with the update applying sequence or anything else I'm not seeing..

Steps to recreate

  1. Install application with Setup.exe created with squirrel releasify
  2. Create new version with incremented version
  3. Check for, download and then apply the new version
  4. During the application of the new release, I can see the icons disappearing from the start menu.

Expected behavior I'm expecting the shortcuts in the start menu to be still be present after applying a new update.

Actual behavior The shortcuts in the start menu gets removed.

Additional information

  • Reinstalling with Setup.exe reinstates the shortcuts in start menu after the shortcuts has been removed
  • Update.exe doesn't seem to do anything to reinstate the shortcuts
  • Code below is used in the winforms client to update image

olabacker avatar Apr 12 '21 10:04 olabacker

I am having exactly the same issue. Have you had any luck?

emorell96 avatar May 30 '21 07:05 emorell96

No, I used custom code to create a shortcut instead.

olabacker avatar May 30 '21 08:05 olabacker

I was thinking of going that route as well.

Would you mind sharing that code snippet? I have found multiple snippets that might work but I'd rather take some code that has worked well in similar situations.

Thanks for the answer though! :)

emorell96 avatar May 30 '21 08:05 emorell96

I can give you that tomorrow as earliest unfortunately!

olabacker avatar May 30 '21 08:05 olabacker

Appreciate that :)

emorell96 avatar May 30 '21 09:05 emorell96

Sorry for late answer. This is the code I used for the shortcut.

private static void AddShortcut(string targetExePath)
{
    string commonStartMenuPath = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
    string appStartMenuPath = Path.Combine(commonStartMenuPath, "Programs");

    string shortcutLocation = Path.Combine(appStartMenuPath, "App.lnk");
    WshShell shell = new WshShell();
    IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation);

    shortcut.Description = "App desc!";
    shortcut.TargetPath = targetExePath;
    shortcut.Save();
}


olabacker avatar Jun 11 '21 22:06 olabacker