Page 36 - MSDN Magazine, June 2019
P. 36
DEVOPS
MSIX: The Modern Way
to Deploy Desktop Apps
on Windows
Magnus Montin
MSIX is the new packaging format that was intro- duced with the October 2018 update of Windows 10. It aims to bring together the best of all previous installation technologies, such as MSI and ClickOnce, and will be the recommended way of installing applications on Windows going forward. This article shows you how to package a .NET desktop application and how to set up continuous integration (CI), continuous deployment (CD) and automatic updates of sideloaded MSIX packages using Azure Pipelines.
First, a bit of background. In Windows 8, Microsoft introduced an API and runtime called the Windows Runtime that mainly sought to provide a set of platform services to a new kind of application, which was originally referred to as “modern,” “Metro,” “immersive,” or just a “Windows Store” app. This kind of app was born of the mobile device revolution and typically targeted mul- tiple device form factors, such as phones, tablets, and laptops, and was usually installed and updated from the central Microsoft Store.
This class of app has evolved quite a bit since then and is now known as a Universal Windows Platform (UWP) app. UWP apps run in a sandbox called an AppContainer that’s isolated from other processes. They explicitly declare capabilities to require the permis- sions needed to function properly, and it’s up to the user to decide whether these capabilities should be accepted. This is in contrast to a traditional desktop application that typically runs as a full-trust process with the current user’s full read and write permissions.
In the Anniversary Update of Windows 10, Microsoft introduced the Desktop Bridge (also known as the Centennial project). It let you package your traditional desktop application as a UWP app, but still run it as a full-trust process. A packaged application can be uploaded to the Microsoft Store or the Store for Business and benefit from the streamlined deployment and built-in licensing and automatic update facilities the store provides. Once you’ve packaged your application, you can also start using the new Windows 10 APIs and migrate your code to the UWP in order to reach customers across all devices.
Even if you’re not interested in the Store or the UWP, you may still want to package your line-of-business desktop applications to take advantage of the new app model that Windows 10 brings. It provides clean installs and uninstalls of apps by automatically redirecting all operations against the registry and some well-known sys- tem folders to a local folder of the installed application, where a virtual file system and registry are set up. You don’t have to do anything in your source code for this to happen—it’s taken care of for you automatically by Windows. The idea is that when a package is uninstalled, the entire local folder is removed, leaving no traces of the app left on the system.
MSIX is basically a successor to the Desktop Bridge, and the contents of an MSIX package—and the limitations that apply to packaged apps—are roughly the same as with the APPX format that the Desktop Bridge uses. The requirements are listed in the
This article discusses:
• MSIX packaging of “classic” desktop applications • DevOps
• Continuous Integration
• Continuous Deployment
Technologies discussed:
MSIX, Universal Windows Platform, Desktop Bridge, .NET, Continuous Integration, Continuous Deployment, DevOps, App Installer, Azure Pipelines, YAML
Code download available at:
msdn.com/magazine/0619magcode
32 msdn magazine