Forum Discussion
THillebrand
Oct 09, 2019Copper Contributor
Update process not started lauching the program by shortcut or taskbar-item
Hi @all! We had developed a client program, deploying it by msix (wapproj with VS2019 (16.3.1), build by AzureDevOps/TFS 2017 with MakeAppx.exe). The update-settings in the appinstaller-file are set...
- Oct 16, 2019
After following up with our team, it turns out current implementation does not trigger the update from taskbar and desktop shortcuts by design. The reasoning was that many of those types of app launches are for completing a task so they were trying to reduce friction for the user. Updates were limited to launches from the Start menu or live tiles.We've added your ask as a feature request for upcoming releases.
ChreesM
Oct 28, 2019Brass Contributor
Tanaka_Jimha- A user should not be able to bypass the auto update process in an Enterprise LOB application. The majority of the MSIX options appear to support this point of view - We have features to support preventing a user from being able to continue with starting the application if there is an update available. It could be that the last release is creating bad data in the database, so you need to get out a hotfix. If they are launching from the desktop or they have pinned to the taskbar, they will bypass all of the controls.
MarosK
Jan 07, 2020Iron Contributor
ChreesM- I have the same opinion on this issue. Automatic check for update process should be started no matter how user starts application. It mean check for update should be performed by clicking on app in start menu, on taskbar button and on desktop shortcut. I opened feature request on MSIX page here.
https://techcommunity.microsoft.com/t5/msix/start-update-process-by-clicking-on-application-taskbar-button/idi-p/1091191
Please upvote for mentioned feature.
Thanks.
- ChreesMJan 21, 2020Brass Contributor
MarosK - Thank you for starting the request. Until this issue is resolved, one workaround would be to leverage the Package AutoUpdater class to check for an update at a given frequency. You can examine the xml at the remote install location to parse out the new version number, (unfortunately the version # is missing from the api). An alternative to parsing the package xml would be to create a text file during the CD process with the version number in it.
using Windows.ApplicationModel;
using Windows.Management.Deployment;
...
private async Task CheckForUpdateAsync() { var update = await _currentPackage.CheckUpdateAvailabilityAsync(); if (update.Availability == PackageUpdateAvailability.Available || update.Availability == PackageUpdateAvailability.Required) { try { _timer.Enabled = false; var packageLocation = GetPackageUrl(); var deploymentResult = await _packageManager.UpdatePackageAsync(packageLocation, null, DeploymentOptions.ForceApplicationShutdown); } catch (Exception ex) { _logger.Info("An error occurred while attempting to update the package: " + ex.Message); } }private Uri GetPackageUrl() { const string mainBundleNodeName = "MainBundle"; const string uriAttributeName = "Uri"; var appInstallerUri = Package.Current.GetAppInstallerInfo().Uri.ToString(); var xmlDoc = XDocument.Load(appInstallerUri); var defaultNameSpace = xmlDoc.Root?.GetDefaultNamespace(); var mainBundleNode = xmlDoc.Descendants(defaultNameSpace + mainBundleNodeName).FirstOrDefault(); var packageUri = mainBundleNode?.Attributes().FirstOrDefault(x => x.Name == uriAttributeName)?.Value; return new Uri(packageUri ?? string.Empty); }
private void GetCurrentPackage() { try { var userSecurityId = WindowsIdentity.GetCurrent().User?.ToString(); _currentPackage = _packageManager.FindPackageForUser(userSecurityId ?? string.Empty, Package.Current.Id.FullName); } catch (InvalidOperationException) { _logger.Info("The running application does not have a package identity, which indicates the process is not executing from an installed application."); } } private async void HandleTimedEventAsync(object source, ElapsedEventArgs e) { if (_currentPackage == null) { return; } await CheckForUpdateAsync().ConfigureAwait(true); }