The Best Thing To Happen To Desktop App Developers: Project Centennial

In this article I am going to explain a technology announced by Microsoft known as "Desktop Bridge," or "Project Centennial," to convert desktop applications into Universal Windows Applications.

In Build '16, Microsoft announced a technology which is going to convert desktop applications into Universal Windows Applications and this technology is going to be shipped with the Windows 10 Anniversary update, which is about to be released soon. This technology is known as the "Desktop Bridge" or "Project Centennial," and it will be the best thing that will happen for desktop application developers who want to use all the features that are available for the Universal Windows platform like Cortana and live tiles. Now you can prepare your applications like Win32 and WPF to convert to Universal Windows Applications by using the Desktop Bridge (Desktop App Converter).


So in this discussion I am going to explain why Microsoft wants this bridge between desktop and UWP, and we are also going to dive into the process of how it will work. So let's start rolling.

Why Microsoft Wanted this Project

Making the Windows Store better

There are a huge number of developers who just learn C# or like me and start developing desktop applications, and the number of desktop applications created so far are more than 16 million. Now when Microsoft started shifting towards bringing all the technologies onto one platform they just skipped over these 16 million+ desktop applications and the desktop developers were like "Ooooooh  gooosh!! What can we do to take advantage of this universal platform and the features involved in it?"

Many developers have surely thought about learning new technologies and have done some hack or custom logic to creat live tiles etc. Now here's the main reason: What developer wouldn't want to have his or her  application running across all the devices Microsoft has created like Hololens, Windows phone, etc.? And more importantly, Windows 10 is running on billions of devices, and imagine the impact if we could convert those 16 million+ desktop applications to the Universal Windows Platform, yielding a great and bulky Windows Store and a great opportunity for the Windows Form/Desktop Developers to have their applications accessible across those billions of devices. So finally Microsoft has designed a technology which takes care of those missing  millions of desktop applications. The project's name is Project Centinniel or Desktop Bridge, and in the Anniversary update of Windows 10,  it will be available for all developers.

Easy Installation and Uninstallation of Application

When we buy a new laptop/ personal computer, it runs so fast. It boots fast, it opens every file very fast and all of the features are pretty much fast. But with time, it get slower and all of the functionality which was very fast, periodically get slowed down. What is the reason for that? You will get this answer shortly.

When you install an application to the desktop through an installer, what the installer does is that it goes to the registries of Windows and adds some new files there, and then there is an Application Folder App_Data, it includes all the files that the application stores while running and there are some other files which get piled into the memory. Now when we re-install an application, it is impossible to remove all of the files associated with that application, and even if you want to remove those --  let's say we want to remove the registries of that application -- the operating system will give you a big dialog box saying something like, "if you delete or modify this registry you will never be able to reboot or blah blah blah your system." So what the system eventually has to do is that when the system reboots it has to load all those registry files and it starts taking time, giving you a latency period in the functionalities. For example, every developer will have installed Visual Studio at some time, and this studio saves about one million registry files in the system and it's around 30 megabytes of just registries.

As compared to the Desktop Applications, UWP Applications has nothing to do with all of the above mentioned processes, and their uninstallation removes the whole application from the system, leaving no extra files, because the Universal Windows Applications have all of these files in their respective folders, so removing those isn't a big issue. So this is how the desktop applications when being converted to the Universal Windows Applications are going to be left with no extra files, hence not causing the system to have latency. I will discuss later how it happens.

Solving Performance Issues

Desktop applications don't have application life cycle events like the Universal Windows Applications have, like onNavigatedTo and onNavigatedFrom. So let's create a mock scenario. You have a desktop application running which is doing some heavy CRUD operations using Entity Framework and when you put your computer to sleep, what actually happens is that your desktop application also goes to sleep with the system staying in memory. Now notice that there is no mechanism that tells the application that our system is going to sleep so please release the resources, or in this case close out all the connections of the Database. So UWP addresses this problem. The applications there have an Application Lifecycle which can determine if the application is paused or stopped etc, and we can perform the related operations accordingly resulting in less usage of the resources and giving some extra performance.

Runtime Memory Optimization

As stated above, in the case of Windows Desktop Applications when the system reboots it has to load all the registry files first. In the case of UWA, the applications work with all the registry files when they are started, not when the system is started. So UWP offers the runtime optimization as compared to the desktop applications. So this gives Microsoft another strong reason to have this project underway.

Deep Dive Into Working of Desktop Bridge

I know by now there will be some obvious questions and some strange feelings about how it will fix the registries or how Universal Windows Applications will allow the third party components to get embedded into it. All of these questions will be answered when you understand the workings of this project.

Now there are basically three main steps of converting your Application using the Desktop Bridge,
  • Convert the Application using the Desktop Bridge
  • Test your Converted Application
  • Deploy your Application

Sounds pretty simple. The first step is solved through some small scripts in the power shell provided by the Desktop Bridge. The third and second steps do not have so much to discuss. So let's discuss the first step and reveal the hidden secrets behind it.

Conversion of Application

The Desktop Bridge in simple terms converts the Win32 application into the AppX Package. The AppX package consists of all the files for the deployment of the UWA. Now let's discuss about how the registry stuff yielding the performance upgrade will happen. Keep in mind the App should be signed before the conversion, which means the App should have digital certificates just for security purposes.

  • The AppX package created by the Converter consists of a file known as Registry.bat. This will be the file which will be responsible for all the handling of the registry files. Now what will happen when the process of registries comes into play is the files in the AppX package are mock files. Understand the work flow now: The registry files will first go into the same place as all the other registries but the developers of this bridge tricked it there and re-directed those registries to the AppX package. The system thinks that the registries are saved in the same place as the others but actually it is in the folder. You can just think it of as Virtualization. The same goes for the App_Data folder. The creators tricked this part too and re-directed the system to the same folder resulting in the data at just one place and deletion of data will be only from one place.

  • After the conversion process now there are two processes in AppX. One is the primary desktop application and the other is the Universal Windows Application running in the App Container. Now there are two possibilities. Either the Desktop Application can communicate with the Universal Windows Application or the Universal Application can communicate with the Desktop Application. Now how  is it going to happen? Actually Microsoft already has a solution for this. So it is already built and the Solution is "App Service". Using the App services , it can result in the bi-directional communication between the two. Now here's your answer coming up about how the external Dll's will be used in the UWP -- and that will be through the App Service resulting in the application. I don't have a demo for this but I will surely show that demo after the converter is  shipped. If the UWP wants to use any third party application it will ask the desktop application to perform it and UWP can then process the final result.

  • After the two process conversion, the Windows store will not allow an application to deploy that has further applications installed in it. So after having the two processes we have to create one process. So far, I don't have any clue about how to do it, but Microsoft is working on all the API's which are not allowed to be used in the UWA's by the developers .

  • After all these processes, the same Win32 Application can leverage the benefit of background tasks, Cortana, Live Tiles and will be able to run on billions of devices.

  • Every application that is converted into the UWP will get an App Identity for registration of being able to send push notifications and live tiles. 

Minor Disadvantage

There is just one disadvantage of this Desktop App Converter, and that is that some Win32 Applications are definitely going to use some drivers and are going to install those into your system while installing. The Converted UWP Application will just not be able to install the drivers but will be able to use those if those are already installed.

The App Converter will soon be released,  maybe in the upcoming month, and the thing that should be kept in mind is that it will be the first version of this converter and Microsoft will keep on adding more features to this converter and all of the related problems can't be answered by the first release. It will take some time to mature and it will definitely be the best thing for the Desktop App Developers that is ever going to happen.

For the sake of information, Saga2000 was the first desktop application which was converted using the Desktop Bridge to the Universal Windows Platform and got the privileges of having the features of UWP.