-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update before Launch??? #1530
Comments
Let me respond by saying: "I'm not sure if this is a bug or a feature request. Also the steps to recreate this issue are quite confusing." And then explain that response a bit further:
|
If you are talking about the RestartApp method, I already have tried that but what happens is when I lunch the app it goes into an infinite loop of updating and restarting the app. , so I tried to put a guard with the CheckForUpdate method - UpdateInfo.ReleasesToApply.Count>0 - and that did not work as well. My apologies if this is the wrong place to ask such question, I did not where else I can ask such question, if you know please let me know and I Will be happy to delete it from here and post it to the new location. Thanks |
First of all, apologies for snapping at you. You obviously have a valid question, but since the "issue" didn't contain any information about the context, it pretty much seemed like an open-ended question that was asked without putting much effort in searching for the answer. Regarding your specific case, I believe you were heading towards the right direction with the If you want to ensure that the application will be updated before making the actual UI available to the user, you should build some sort of a launcher class that would be instantiated before the actual application class is instantiated. And on the happy path, when At least, off the top of my head, these should be more or less what needs to be done. I hope I'm not misleading you. |
No worries. Trust me I have been banging my head against this the whole day so you can imagine the frustration. What makes it worse is when I tried to follow examples used on demo videos like "https://channel9.msdn.com/Events/dotnetConf/2015/Squirrel-for-Windows-installing-NET-apps-the-way-it-should-be" (Minute 40) or blog like "https://madstt.dk/squirrel-the-basic/" that mention the restartApp it doesnt seem to work and the application goes into the infinite loop. I will try to follow what you explained even though it doesnt seem simple. If you find it in yourself to provide a code for that I would really appreciate it and I believe it would be great help for others who want to avoid clickonce. My application is called in batch command and it has to update before lunch. Thanks for the time and the help. |
Squirrel is a library, not a wrapper around your application like ClickOnce, there is no way to update the app before your app runs. I think @uygary has the right idea around making your app check for updates and relaunching itself. |
Thanks anaisbett for your post. There are some post out there that makes it look as if its possible to accomplish through the RestartApp method as I referenced in my previous post. Not sure if I'm missing something or those posts are misleading. I think it would be worth if someone can provide code on how to do this because I would believe that most people who want to switch from clickonce to squirrel would expect that the app would update itself before launching or at least this option is available. I have been struggling to do so wither within the app itself or through a wrapper. Thanks |
I actually don't want to encourage people to do that, it's pretty user-hostile and against the fundamental design of Squirrel, which is to never have updates take precedence over what the user actually wants to do with their computer. If RestartApp isn't working you should try to debug into what's going on, or possibly just not use it and restart yourself via running the stub executable (the executable installed above the app-xyz directory) |
That is really unfortunate! My application runs on auto mode via the taskscheduler and there is no user interaction when that happens. |
@anaisbetts's comment regarding this being against the design philosophy of the library is obviously valid. But I still believe Squirrel is simply better than so many alternatives even in this particular use-case that it's worth the effort of handling the update flow in the application code and using Squirrel for apps that inherently go against the design of the library. That being said, what @samer1977 has been asking about is something I had done in the past in an old pet project of mine. The app was a networked app, and it would use semantic versioning. If the major version was bumped, that would mean a protocol/contract change, so the launcher would force an update/restart cycle. If the minor version was bumped, the launcher would instead update but not force a restart. However, it's been years, so many changes might have happened in the interim. I'll see if I can wire up a simple example for @samer1977 when I have a bit of time. |
@samer1977 how are you creating a Scheduled Task without UAC elevation? |
@anaisbetts, what @samer1977 is asking for is a very valid and not-unusual requirement. |
@anaisbetts we use an ETL server that is logged in with service account and we schedule/run the task using this account.
|
@samer1977 I had a bit of time to have a quick look and mock something up last night. This example should be good enough to give you an idea. The main logic is on line 44 in UpdateService.cs and on line 51 in App.xaml.cs. |
@uygary Thanks for taking the time to do the application. I have downloaded the code and ran it locally and created the squirrel nuget package for app to install. First time the app installed successfully and launched the current version ( 1.0.0.0). I have pumped the version to 1.0.1.0 and when I created the new release under the local releases folder, I went and launched the application but still showed previous verison (1.0.0.0) only when I close and reopen it launches the new version. I tried it again and pumped to (2.0.0.0) this time but when I launch the app from the short cut it gets stuck on "Checking for Updates..." so I closed the app and re launch again and it was showing the latest version. So is it suppose to work this way?! because I thought it should restart the app and relaunch to latest version by itself, unless Im doing something wrong. Thanks again for the time. |
@samer1977 definitely not. The RestartApp call is supposed to restart the application on the bump to v2, so I'm at a bit of a loss here. In fact, I've just tried this code again believing that it did not work at all and I've just failed to test it properly, but I can say it is actually working for me. Can you try debugging UpdateApp and see what's going on in there? |
@samer1977 here is the code (loosely modified) I use for my application where the client must be running the latest communication contract:
Edit: Note, this will not update before launch, but it will give you a chance to put the launching application into an updating state, and re-launch with the updated executable when complete. |
1.9.1
Which version(s) of the project are you using?
Description
Can someone provide an example -if possible with squirrel- on how to get the update before launching the application? This seems to be very simple question but I could not find anything to help with that...documentation is very poor. Thanks
Steps to recreate
Expected behavior
Explain what it's doing and why it's wrong
Actual behavior
Explain what it should be doing after it's fixed
Additional information
Add any other context about the problem here
The text was updated successfully, but these errors were encountered: