UWP has a very nice app update mechanism outside of the store that allows you to publish new releases to a public-facing website – and UWP taking care of the rest. And while the docs recommend Azure Web Apps for this, you can get the same results for a lot cheaper using the Static Websites feature in Azure BLOB Storage.
Enabling MSIX ms-appinstaller protocol handler to support auto updates
Unfortuantely there’s one major drawback with this automatic update mechanism: it has been disabled by Microsoft by default on all Windows machines due to security concerns. That means it needs to be re-enabled manually on all devices you want to support.
- Ensure you have App Installer Version 1.17.10941.0 or newer installed which you can get through the Windows Store
- Donwload the Desktop App Installer policy and unzip it into the %systemroot%\PolicyDefinitions folder
- Afterwards you can enable the policy through the Local Group Policy Editor by navigating to Computer Configuration > Administrative Templates > Windows Components > Desktop App Installer and selecting Enable App Installer ms-appinstaller protocol.
Configuring Update Location in the UWP App
The easiest way to set the URL from where to get the updates inside the UWP App is to set it in Visual Studio though the Project -> Publish -> Create App Packages dialog.
This will update the AppInstallerUri Property inside your apps .csproj file. The URL should point to the root of the BLOB Storage’s Static Website inside the $web container and will look something like this: https://myappupdate.z1.web.core.windows.net
Deploying App Package to Azure BLOB Storage using Azure DevOps Pipelines
The following YAML script shows how to build, sign and upload the UWP app to Azure BLOB Storage’s static website container. You do need to make sure that with each build the app’s version number increases in order for the automatic update to work. This can be done in the pipeline as well but is not within the scope of this blogpost.