Squirrel.Windows
Squirrel.Windows copied to clipboard
How to stop Squirrel creating unwanted shortcuts and executing supplementary executable on first install?
Squirrel version(s) 1.9.0
Description We have a new Squirrel package which contains our C# executable (.Net Core 3.0) and the open source NSSM (3rd party EXE).
Just having this EXE present causes it to 1 - get a shortcut and 2 - be executed by Squirrel which is trying to be helpful. However we don't want NSSM to be executed!
In our C# app I have implemented and handled Squirrel events and proven this with a messagebox as shown:
using (var mgr = new UpdateManager("http://updatepath")) { SquirrelAwareApp.HandleEvents( onInitialInstall: v => MessageBox.Show("onInitialInstall"), onAppUpdate: v => MessageBox.Show("onAppUpdate"), onAppUninstall: v => mgr.RemoveShortcutForThisExe(), onFirstRun: () => MessageBox.Show("onFirstRun")); } My messagebox for `onFirstRun1 handler shows correctly so I know Squirrel events are being handled and my C# app is Squirrel aware.
However, NSSM is still being launched and the Squirrel install log file shows this still:
[20/06/21 18:52:09] info: ApplyReleasesImpl: About to save shortcut: C:\Users\me\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\path\NSSM 32-bit.lnk (target C:\Users\me\AppData\Local\MyInstaller\nssm.exe, workingDir C:\Users\me\AppData\Local\MyInstaller\app-1.0.3, args , toastActivatorCSLID b08a06b3-8113-5e78-bdad-e989db8e9d25) [20/06/21 18:52:09] info: ApplyReleasesImpl: Creating shortcut for nssm.exe => C:\Users\me\Desktop\NSSM 32-bit.lnk [20/06/21 18:52:09] info: ApplyReleasesImpl: About to save shortcut: C:\Users\me\Desktop\NSSM 32-bit.lnk (target C:\Users\me\AppData\Local\MyInstaller\nssm.exe, workingDir C:\Users\me\AppData\Local\MyInstaller\app-1.0.3, args , toastActivatorCSLID b08a06b3-8113-5e78-bdad-e989db8e9d25) [20/06/21 18:52:09] info: ApplyReleasesImpl: Starting fixPinnedExecutables
Expected behavior Should only run our C# exe, not supplementary 3rd party EXE NSSM
Actual behavior Should only run our C# exe, not supplementary 3rd party EXE NSSM
Additional information See above.
This has been posted on SO: https://stackoverflow.com/questions/68058675/squirrel-creating-and-executing-all-exe-files-in-package
I believe the problem here is that .net core creates a stub executable, which doesn't get the squirrel attribute(s) embedded - instead, they end up in your DLL. The solution here would be to update squirrel to play better with .net core, which it seems no one wants to take on.
See #1692 and issue #1644.