Squirrel / Squirrel.Windows

An installation and update framework for Windows desktop apps
MIT License
7.33k stars 1.03k forks source link

Need to know about [assembly: AssemblyMetadata("SquirrelAwareVersion", "1")] #1618

Open SunnySv72 opened 4 years ago

SunnySv72 commented 4 years ago

Hi @anaisbetts, I am trying to implement the Squirrel.Windows in my window forms application. As mentioned in document for customize squirrel events, I did code. i.e.

using (var mgr = new UpdateManager(ProductInfo.Instance.UpdaterURL)) 
{
          SquirrelAwareApp.HandleEvents(
                 onInitialInstall: v => mgr.CreateShortcutForThisExe(),
                 onAppUpdate: v =>
                 {
                     //logic
                 },
                 onAppUninstall: v =>
                 {
                     //logic
                     mgr.RemoveShortcutForThisExe();
                 });
}

it works fine however, I have some queries i.e.

Looking forward for your quick response.

Thanks.

ComtelJeremy commented 4 years ago

Perhaps this might help. If not, please excuse my comment on this issue. This might be the relevant code to your question here. From what I can gather (from the code and from my own experience with Squirrel), if no apps are marked as SquirrelAware the installer / updater runs them all. See this line and below.

We used the same approach as you in our production app, but later had to mark our main app as SquirrelAware once the software grew and we had two executables in the installer (as we then all of a sudden had both apps run automatically on install instead of the one we wanted).

However, I am not certain about the non-standard install logic running (as in your code above) without being SquirrelAware (especially onAppUpdate). It seems from the code that non-SquirrelAware apps aren't run by the UpdateManager with the argument "--squirrel-updated" and therefore wouldn't run the onAppUpdate lambda, but I could be mistaken.