Auto launch main app after updater installs upgrade? - Advanced Installer Community
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Auto launch main app after updater installs upgrade?

Hi,
I haven't found a way to do this yet. I would like to conditionally (based on an INI value) automatically start up my application after it has been upgraded to the latest version by the Updater.exe. In my scenario, when an upgrade is published the user can acknowledge a message to "Download and Install Now" or "Download and Install Later".

In the "now" scenario, the installed application does not launch, so that the updater can download and silently install the upgraded version. After the silent upgraded version has completed installing I would like to make it so that the main (upgraded) application is launched. Kind of like the opposite of the "Auto Close Applications", I really need a way to do a conditional-auto-open of my main (upgraded) application.

Can this be done?

Thanks.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Auto launch main app after updater installs upgrade?

Hi Kevin,
After the silent upgraded version has completed installing I would like to make it so that the main (upgraded) application is launched.
In order to achieve that, you can go in “Custom Actions” page from the project file of the upgraded installation package and add the predefined Launch installed file custom action with sequence after InstallFinalize standard action, uncheck the "Wait for custom action to finish before proceeding" and "Fail installation if custom action returns an error".

In order to execute this custom action when an upgrade is performed, in the Execute Stage Condition click on Show upgrade options and only enable the Upgrade checkbox.
I would like to conditionally (based on an INI value) automatically start up my application after it has been upgraded to the latest version by the Updater.exe.
You can perform a .ini search in the Search Page and use the property (by default it is RESULT_PROPERTY) which has been assigned to the search operation as a condition for the custom action above.

I attached a .zip archive that contains a sample project which implements your scenario.

Best regards,
Dan
Attachments
SampleProjects.zip
(674.58 KiB) Downloaded 646 times
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Auto launch main app after updater installs upgrade?

Hi,
Ok, I setup the CA as described except that I didn't see any checkbox called "Fail installation if custom action returns an error". I do see "Wait for return code at the end of the sequence" which I left as checked.
[EDIT: I have since looked at the attached AIP you included and setup my projects to match, and still have the problem below: hidden instance of my main app is running; at least that is what seems to be the problem].

Also, the "Execute Stage Condition" section was not found anywhere. Then, I realized that when I went off this "input screen" and came back that those values did start to show up. [So, I think that when you start a new "Launch installed file" CA it may be that the UI is not reflecting all of the available options.]

I also setup the INI search so as to set the condition when to launch, but it seems like what is happening is that the application is launching hidden/silently. If I try to open it it fails with the notification that we have which tests to make sure it is running as a single instance.

I looked in Task Manager to see if I could End any hidden/silent instances but there were none to be found in Task Manager. What can I do to "show" this apparent hidden instance?
[EDIT: further confirmation that there is a hidden instance (perhaps it is being launched by the System account?) is that if I do a reboot (logoff is not enough) and then try to open it, then it succeeds, presumably because the hidden instance was closed down by the reboot.]

Thanks.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Auto launch main app after updater installs upgrade?

Hi Kevin,
If I try to open it it fails with the notification that we have which tests to make sure it is running as a single instance.
If you use the Install support service feature from Updater Page whitch allow updater to run as a service, then the UI applications will not be shown. This is happening because of security risk, more information about this is described in this article Session 0 Isolation. If a service belonging to an application throws a UI, the application is waiting on the service, and the UI is not displayed in the user session.

If you want to launch your application at the end of the installation process, when you deploy your updates using the support service, then please keep in mind that this is not possible.

However, if you want to launch your application of the end of the installation process, you can uncheck the Install update without elevation option from the Updates Configuration Projects. Please keep in mind that you cannot install your application silently, as there will be no UAC prompt, but if you enable the Run as admin option for the updater shortcut you will be able to install silent your updates, of course with an UAC prompt.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Auto launch main app after updater installs upgrade?

Hi Dan,
Ok that's a bit unfortunate, but I think I understand. For sure the main reason we purchased AI was to be able to do installations without UAC elevation, which gives us a nice silent-auto-update feature for our application.

Can you please confirm that my understanding of this whole process is correct, so I can relay the layman's description to my supervisor:

Because we must have Install update without elevation turned on (we have promised this to our customer base already), then, this means we have to use the "Install Support Service", which in turn means, that we cannot auto-launch our application after it was silently upgraded, because the updater is running as a service.

Do I have that correct? Assuming I do have that correct, can you tell me if we can implement some other way of notifying the user when the update without elevation installation is completed?

The reason we really need this is that we have committed to offering these 2 options when our application starts-up and it finds an available update has been published: "Download and Install Now" and "Download and Install Later". If they select the "Download and Install Now" we auto-close our main app so that we can, download the update, install it and then what? This is why we wanted to auto-launch after the update was applied so they had a UI way of knowing that the process is complete. If we can't auto-launch, is there something else you can suggest that we can we do to "inform" the user that the update has finished so that they can manually launch the main app without stepping on the "update" process.

Thanks.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Auto launch main app after updater installs upgrade?

Hello Kevin,
Because we must have Install update without elevation turned on (we have promised this to our customer base already), then, this means we have to use the "Install Support Service", which in turn means, that we cannot auto-launch our application after it was silently upgraded, because the updater is running as a service.
Indeed, this is correct.
You cannot launch any User Interface from the .MSI which is installed by the Updater which is running as a service.

However, you can start your application, after it has been installed though the updater, not by using the installation package to launch your application.
In order to achieve that, in the Edit Auto-Close Application Dialog from the Auto Close Applications Tab tab you can enable the Restart Always options.
The application configured will be restarted no mater what if was running before installing updates or not. So, your application will be launched after the installation is finished, as you want.

So, the only User Interface which can be displayed for the users when the updates are installed without elevation (that means the .MSI in installing silent, with no UI) is through the Updater UI, but you are not displaying any UI for the updater, you are using the updater.exe /silentall command line switch, which means the Updater will search silently for updates.

By the way, we already have an improvement on our TODO list to have an Reduced UI for the updater when the silent or silentall switches are used, something similar with a previous request of yours (of course the updates can be installed silent as well). I'll let you know when this will be available.

If there is anything else I can help you with, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Auto launch main app after updater installs upgrade?

Hi Dan,
Ok, now that the "-reducedgui" option is available I am starting to research my other questions/complications.

Regarding the Edit Auto Close Application dialog in the updater configurations project, it seems we have a bit of a non-standard approach. Our application (let's call it Overmain.exe) is shelled to / launched by what we call our splash program (called Overture.exe).

When a user first starts our app naturally it is Overture.exe that is running and it is that Splash screen that checks for and prompts the user if an update has been published. If the user says "download and install now" then we don't ever launch the "Overmain.exe", because it is going to be replaced by the downloaded & installed automatic update. It is this scenario where we would obviously like to auto open the newly updated application;ideally at the end it would open "Overture.exe" (since it's the splash it would again look for any update, find that there are none that apply) and would shell to the "Overmain.exe". Since the user launched our app, agreed to update it now and so when the update is done it would be perfect if the app launched itself after this sequence (call this the "go get coffee and voila! app is updated and ready to use when I get back" scenario).

If the user says "download and install later" then "Overture.exe" just launches "Overmain.exe" while the Updater does the download in the background and when the user exits "Overmain.exe" (assuming the download is completed; we use "/justcheck -installready") we then do the "/silentall -reducedgui -nofreqcheck" installation and that is the end of it for this scenario. We do have a 2nd path to this latter scenario and that is: "Overmain.exe" is running, the user goes to the Help > Check for Updates and the Updater finds a newer published version and then the user can either "download and install later" (because the app is running we don't want to initiate an auto close), or "remind me later" which basically dismisses the prompt.

So, given these existing scenarios, if they chose to "download and install later" and I want to use the Restart Always scenario targeting the "Overture.exe" application I can just popup a message "Overture has been updated!" type message to get around the fact that I didn't really want an auto-open in this scenario; that's a fair enough outcome. But the real problem I have is that the application that I want to Auto-Close typically would be "Overmain.exe" but it is "Overture.exe" that I would typically want to "Always Restart" so that puts me in a dilemma with regard to this Edit Auto Close Application dialog. Not only that, the "Overture.exe" is a title-less window because it is a splash screen.

Can you please advise?
Thanks.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Auto launch main app after updater installs upgrade?

Hello Kevin,

I'm afraid I don't fully understand what is the particular scenario you have. Can you please give us more details about what you are trying to achieve? Also, try to give us a bit more information about your applications and about how your applications are launching the Updater to check, download and install updates.

If you could iterate a more detailed step by step description about your applications' update scenario this would be very useful too.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Auto launch main app after updater installs upgrade?

Hi,
On start-up of our application our splash screen (which is a small, separate, 1-form EXE) checks to see if a more recent version of our application has been published. If nothing is available then it launches the Main application's EXE, as you would expect. If a newer version is available then the user is prompted to accept that update or be reminded later. The "accept" scenario has two options: 1) "Download & Install Now" or 2) "Download & Install Later"

In "Download & Install Later" mode, which is working as expected, the Main app is launched by the splash screen and while the user is working within our app the Updater is downloading the newest version in the background. When the user elects to Exit out of our app then they are prompted to install the latest downloaded version. In this scenario the installation occurs as expected and the system should _not_ auto launch the app, because the user downloaded, exited, installed, and doesn't need the system to auto-start for them. Again, this is working as expected. Our updater switches in this scenario are:

Code: Select all

/silentall -reducedgui -justdownload -nofreqcheck
In "Download & Install Now" mode, which is _not_ working as expected, the Main app isn't launched by the splash screen because we want the Updater to do the download and installation using the -reducedgui flag and that is working very well. It is at the end of that -reducedgui process, however, that we need the installer to auto-launch our splash screen (which will see no updates available and launch our Main app). So from the user's perspective this is ideal: they launched our app, it notified and auto-updated, and then it should auto launch the app as they requested, but it doesn't. Our updater switches in this scenario are:

Code: Select all

/silentall -reducedgui -nofreqcheck
I hope this makes it more clear for you as to what we are looking for.

Thanks,
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Auto launch main app after updater installs upgrade?

Hello Kevin,

From what I understood what you want is:
1. when the user choose "Download & Install Later" mode the splash screen app should not to be restarted after updates installation
2. when the user choose "Download & Install Now" mode the splash screen app should always be restarted after updates installation

I'm afraid we don't have predefined support to conditionally set at install time the "Disable Auto Restart" flag from "Auto-Close Application Dialog".

However, as a workaround, you can leave unchecked the "Disable Auto Restart" flag of your application set in the "Auto Close Applications tab" from your updates configuration project. In this way the application will be always restarted if it was running during updates installation.

Now, if you want your application not to be restarted when the "Download & Install Later" mode was selected, then you can add some custom functionality in your application to handle this scenario. For example, you can set a flag when this option is used (e.g. create a registry value) and, then on every application start up check if the registry value is set/exists. If so, then automatically exit the application and delete the registry, otherwise start the application as usual.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”