2

We are trying create an installer using Squirrel.Windows for our .NET application The application contain multi .exe files. We using command:

squirrel --releasify BIN_PATH\MyApp.2.0.33404.nupkg

However, when run the setup.exe, it create multi shortcut on desktops correspond to multi .exe files How to specify create one shortcut only ?

phuongnd
  • 1,229
  • 15
  • 33

1 Answers1

4

The Squirrel documentation states that creating a shortcut for every EXE in your package is the default behaviour.

That same documentation page explains that to override the default behaviour you need to make at least one of your EXE Squirrel aware and then implement the Squirrel event handlers as you want to.

You better make the one EXE you want a shortcut for Squirrel aware by adding the following to its AssemblyInfo.cs:

[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]

Then in your EXE implement Squirrel events like that:

static bool ShowTheWelcomeWizard;
...
static int Main(string[] args) 
{
    // NB: Note here that HandleEvents is being called as early in startup
    // as possible in the app. This is very important! Do _not_ call this
    // method as part of your app's "check for updates" code.

    using (var mgr = new UpdateManager(updateUrl))
    {
        // Note, in most of these scenarios, the app exits after this method
        // completes!
        SquirrelAwareApp.HandleEvents(
          onInitialInstall: v => mgr.CreateShortcutForThisExe(),
          onAppUpdate: v => mgr.CreateShortcutForThisExe(),
          onAppUninstall: v => mgr.RemoveShortcutForThisExe(),
          onFirstRun: () => ShowTheWelcomeWizard = true);
    }
}
Slion
  • 2,558
  • 2
  • 23
  • 27