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

Shortcut name for MyApp-Env defaulting to MyApp

Open enoumen opened this issue 10 years ago • 2 comments

I am using Squirrel to package and install MyApp. I want to be able to differentiate my same App deployed for different environments with different shortcuts. I have MyApp-Dev.exe and MyApp-Qual.exe but when I install them they all create the same shortcut as MyApp (MyApp.lnk) and erase the existing shortcut on Desktop. How can I create the app with squirrel and require the shortcut to match exactly the executable (Example: MyApp-Qual.lnk for MyApp-Qual.exe, MyApp-Dev.lnk for MyApp-Dev.exe , MyApp.lnk for MyApp.exe) Thanks Etienne

enoumen avatar May 03 '16 15:05 enoumen

I would also like to know how to do this. I'm afraid this repo is dead though :(

jjwilliams42 avatar Aug 31 '16 06:08 jjwilliams42

You may need to take over the SquirrelAwareApp events and handle it yourself. Give that a whirl and see if that makes a diff.

It's going to involve a little msbuild trickery as well, so you can produce the MyApp-{Channel}.exe, but it might be doable.

Maybe something like this:

using (var mgr = new UpdateManager(appConfig.UpdateUri.AbsoluteUri)) {
    var fInfo = new FileInfo(Assembly.GetExecutingAssembly().Location);
    var exeName = fInfo.Name;

    var locations = ShortcutLocation.Startup | ShortcutLocation.Desktop | ShortcutLocation.StartMenu;

    SquirrelAwareApp.HandleEvents(
        v => mgr.CreateShortcutsForExecutable(exeName, locations, false),
        v => mgr.CreateShortcutsForExecutable(exeName, locations, true),
        v => mgr.RemoveShortcutsForExecutable(exeName, locations),
        v => mgr.RemoveShortcutsForExecutable(exeName, locations)
    );
}

specifically the second and third line, where I'm dynamically capturing the exe name, instead of assuming it is MyApp.exe

dealproc avatar Sep 03 '16 07:09 dealproc