The old meets the new in the WinRT API packages
A Windows Forms application that runs on. NET Core and calling the UWP API
Microsoft has released "WinRT API Packs" for Windows desktop developers, allowing you to access platform functions that were previously restricted to UWP applications, as well as a web designer. Windows Forms preview for .NET Core 3.0 desktop applications.
There is much to analyze here. The world may be trying to forget Windows 8, but it marked a change of direction for Windows desktop development that is still significant today. Windows 8, launched in 2012, introduced Windows Runtime, or WinRT, which aimed to provide a secure, tactile and application-oriented application platform along with the familiar Win32 / Win64 platform.
Microsoft soon began pedaling backward as the new platform could not win adoption. Windows 10 in 2015 restored the desktop as the main user interface, but in the meantime the developer division had dutifully performed many modern API functions specific to WinRT. Microsoft made the transition from WinRT to UWP (Universal Windows Platform), retaining some of the concepts of WinRT, but with the idea of running on desktop computers, phones, Xbox and Windows HoloLens.
Much of the reason behind UWP disappeared when Windows Phone died, leaving Xamarin (Windows, iOS, Android and Mac) is the closest thing Microsoft has to a universal development framework. Microsoft still offers UWP as an option, but in most cases there are few advantages and some disadvantages when creating a desktop application for Windows.
That leaves the question of what to do with those WinRT APIs. The new WinRT API package, now generally available, is a package that you can add to desktop applications that makes those APIs available, covering areas such as geolocation, AI (including voice recognition), maps, sensors and more. While the ability to call WinRT APIs from desktop applications is not new, it is now easier since the package handles all the necessary contract files and assembly references.
There are still complications. One is that some UWP APIs require what Microsoft calls "packaged applications." This means that you must wrap the application in an MSIX installation package for them to work. The package gives the application a system identity used for permissions and more. The details of which API work are here. Therefore, the Windows API remains untidy as developers continue to pick up the pieces of Windows 8 and Windows Phone failure.
Another problem is that UWP APIs naturally do not work on Windows 7. While this used to be a deal Today, it is not much, since Windows 7 ceased to be compatible in January 2020. Another great Problem for the developers of the Microsoft platform is the transition from the .NET Framework only for Windows to the .NET Core cross-platform and open source. Newly released version 3.0 adds support for desktop applications that use WPF (Windows Presentation Framework) and Windows Forms. However, full compatibility with Visual Studio is slow, and a visual designer for Windows Forms with .NET Core has just come to the preview.
This Windows Forms designer has been completely rewritten. The complication is that Visual Studio uses .NET Framework, not Core. Microsoft has written a new linking process, WinFormsSurface.exe, which communicates between the designer and the main part of Visual Studio.
The consequence of this trick, and the differences between the two varieties of .NET, is that this remains "an early preview with many features yet to be implemented," according to the release notes.
You can use this with the WinRT API package and it was easy to run a quick sample by calling the geolocation API.
Why? Does Microsoft bother with Windows forms? The reason is that the company has yet to improve it for quick and easy desktop development, despite the fact that WPF is far superior in scale, visual transitions and more.
Is desktop development still important? Looking over Microsoft's Future Decoded event in London, you would think not. AI and the cloud dominate, and for multiplatform on mobile devices you still need Xamarin, or an alternative framework like Google Flutter.
However, the reality in business is that many of us still spend much of our time hitting PC keyboards and as long as that remains true, you can expect Windows desktop development to remain important. ®
Beyond the data frontier