What You Need to Know About Converting Desktop Apps to UWP

store
Windows Store apps

In today’s Ask the Admin, I’ll look at some of the benefits of converting Win32 desktop apps to run in a UWP wrapper that can be distributed via the Windows Store in Windows 10 Anniversary Update.

With the Windows 10 Anniversary Update now dropping via Windows Update for Microsoft customers in the U.S., you might find some surprises in the Windows Store in the form of apps that were previously Win32 only.

Microsoft would prefer that apps are written or rewritten for UWP, but at the same time acknowledges not all organizations will be able to port applications. This might be due to a lack of resources, technical limitations of UWP, or because the original app developers are no longer in business to undertake a complete rewrite. As such, the ability to package Win32 apps for the Windows Store provides a temporary bridge in scenarios where apps cannot be converted to native UWP.

Desktop App Converter Preview (Project Centennial)

Сodenamed Project Centennial, the Desktop App Converter Preview for Win32, Windows Forms, and WPF-based apps allows developers to run existing installers through the tool, resulting in an UWP AppX package. The converter makes “before” and “after” snapshots of the OS, capturing changes made to the filesystem and registry as the installer executes. The Win32 app also receives an AppX package identity as part of the conversion process, allowing it to call UWP APIs.

The Win32 app’s code isn’t changed by the converter, but wrapped in a package that can be submitted to the Windows Store, the private portal in Windows Store for Business, or manually sideloaded onto devices. Windows 10 Anniversary Update (AU) allows apps packaged in this way to run with full trust if needed, as opposed to inside a sandboxed container, a requirement for standard UWP apps.

Desktop Conversion extensions

Win32 apps packaged using the converter can utilize Desktop Conversion extensions, which enable access to certain APIs that are not normally exposed to UWP apps. These APIs are designed to smooth the transition between desktop and UWP, enabling features such as File Explorer integration, and starting a process when a user logs in to Windows.

Key advantages of UWP

Because UWP apps are designed for secure, modern computing, there are numerous advantages to converting Win32 apps to AppX packages. UWP apps can be loaded and removed cleanly, leaving no traces in the file system or registry – think Windows rot – ensuring that OS performance and reliability aren’t negatively affected. And the ability to manage the full lifecycle of UWP apps, i.e., installation, updates, and removal via Windows Store and Windows Store for Business, relieves developers of having to deal with separate update mechanisms.

Once a Win32 app has been converted, developers can gradually add UWP features, taking much of the risk out of converting the app to UWP straight away. This includes the ability to use live tiles, app services, and XAML user interface. Converted apps can either run in Docker-style Windows app containers, or full-trust UWP containers.

Preparing apps for conversion

But like most good things in life, there are some drawbacks. Microsoft has published a list of requirements that should be checked before you try to convert a Win32 app to UWP. For example, .NET apps must be based on version 4.6.1 or higher. All apps must be able to run without administrator privileges, and should not read or write to the HKEY_LOCAL_MACHINE (HKLM) registry hive.

Most of the requirements listed are based on best practices for app development laid out by Microsoft for many years, but some legacy apps may need modification before they can be packaged for UWP. For a full list of requirements, see Microsoft’s website here.