Windows  Microsoft e

Microsoft is continuing to show the path for creating a Universal Windows Platform (UWP) using the Desktop Bridge. Windows Blog shows how to convert a desktop app into a UWP app that will function across Windows 10 devices.

The Desktop App Converter has also been given an update. Support for auto detecting shell extensions from a desktop app and declaring them in the AppXManifest of the app package has been added.

In its blog post, Microsoft points out that bridging apps from desktop to UWP is done through three phases. The Desktop Bridge phases are Convert, Enhance, and Extend.

“Convert your existing desktop app, which continues to run exactly as it did before, with the added benefit of using the universal Windows packaging model to deliver the app to users

Enhance your existing codebase with UWP API calls to implement new functionality, such as Live Tiles, notifications and roaming app data

Extend your existing codebase with a new App Container process, which can be used to add things like XAML UI and app services, while still being able to use your existing desktop app’s functionality through two-way communication between the App Container process and the desktop app process”

Desktop-Bridge-UWP-Microsoft-Windows-Blog

Desktop apps are deployed through the Desktop App Converter through a special UWP packaging model after conversion. Microsoft says that developers do not need to make many changes to their app. Most Win32/.NET/COM APIs work as they are, but there are some exceptions. The company details those exceptions:

The app cannot write to HKEY_LOCAL_MACHINE even when run with elevated permissions. Post-conversion registry writes are located in a private hive and are not visible to outside processes. App package files are in a locked location, developers will need to change code to make changes to those files.

API Support

Microsoft says that users are able to use the APIs to communicate with drivers and NT Services, so no extra code is needed. The company adds that the Desktop Bridge gives developers instant access to UWP porting thanks to a large list of compatible APIs.

However, there are two APIs that do not work when brought from an existing desktop app for conversion. UWP has a different UI model to desktop apps, so older applications without modern UI elements require extra re-coding. Windows.ApplicationModel.DataTransfer.ShareTarget is an example of an API that needs modern UI elements.

Microsoft also lists a number of API namespaces that do not work within the Desktop Bridge for UWP. In the blog, the company also details how to call UWP APIs from a Desktop app. The process starts by ensuring “WinMD” files are added as references to your desktop app’s project in Visual Studio.

Completing the Bridge

Finally, developers can complete their UWP Bridge and prepare their app for the Windows 10 platform. The Universal Windows Platform allows apps to play across all Windows 10 devices, including Xbox and HoloLens. To complete the bridge, developers must migrate code to be able to fully run in an App Container process.

The company describes this part as “more complicated” and points developers towards a sample in the GitHub repository on AppServices.

For full details for all of the Desktop Bridge processes, check out the full blog.