Forum Discussion
MSIX update on launch fails with "Unable to install because the following apps need to be closed"
Generally, one can update an app (assuming it is not running) in a single try.
Normally, I would expect that with the appinstaller posted, if you triggered the upgrade by a change to the back-end appinstaller file followed by the user launching the app, the installation will be held off and will occur after this app session closes down in the background (which is nice),. Thus you see the new version on second launch.
There is an additional option as part of the 2nd version of the schema for the appinstaller file to block the "activation" (i.e. launch) of the app by the user when it detects the update and prompt the user as to if they want the update. If affirmative, the update happens immediately and the user can then launch the upgraded app.. You'd add both ShowPrompt="true" and UpdateBlocksActivation="true".
The doc on this option is https://docs.microsoft.com/en-us/uwp/schemas/appinstallerschema/element-onlaunch and you need to reference this version of the schema using
xmlns="http://schemas.microsoft.com/appx/appinstaller/2017/2"
If you don't like the user seeing the prompt, and they never log out, you can also consider using the AutomaticBackgroundTask option of the schema which will look for updates every 8 hours whether or not the user is running the app.