Search code examples
windows-installerelectronelectron-packagersquirrel.windows

Electron Squirrel.Windows: .msi not working


I developed an Electron app and with the use of eletron-packager and then electron-squirrel-startup I created .exe and .msi installer files. The .exe file is working fine, but the .msi is not. It looks like it just stops at some point and turns off. In the Control Panel I can see “my_app Machine-Wide Installer”, I am not sure if that is the desired effect, but nonetheless, my_app is not installed.

I have a pretty basic handleSquirrelEvents function:

switch (squirrelEvent) {
    case '--squirrel-install':
    case '--squirrel-updated':
        // Optionally do things such as:
        // - Add your .exe to the PATH
        // - Write to the registry for things like file associations and
        //   explorer context menus

        // Install desktop and start menu shortcuts
        spawnUpdate(['--createShortcut', exeName]);

        setTimeout(application.quit, 1000);
        return true;

    case '--squirrel-uninstall':
        // Undo anything you did in the --squirrel-install and
        // --squirrel-updated handlers

        // Remove desktop and start menu shortcuts
        spawnUpdate(['--removeShortcut', exeName]);

        setTimeout(application.quit, 1000);
        return true;

    case '--squirrel-obsolete':
        // This is called on the outgoing version of your app before
        // we update to the new version - it's the opposite of
        // --squirrel-updated

        application.quit();
        return true;
}

It's a bit far-fetched but maybe it has something to do with digital signatures?


Solution

  • I found this : https://github.com/Squirrel/Squirrel.Windows/blob/master/docs/using/machine-wide-installs.md

    It says:

    Machine-wide Installs Squirrel's Releasify command generates an MSI file suitable for installation via Group Policy. This MSI isn't a general-purpose installer, this means that once you run the MSI, users from now on will get the app installed, on next Login.

    So, most normal users should continue to run the Setup.exe's generated by Releasify, but if you want to have an IT Admin Friendly version, you can hand off the MSI

    Most users of Squirrel won't have to do anything new to enable this behavior, though certain NuGet package IDs / names might cause problems with MSI.

    It looks like my .msi is working just fine only I expected different results.