Windows 10 April 2018 Update Brings UWP Multi-Instancing, UWP Console Apps and Broader File System Access
The Windows 10 April 2018 Update introduces support for UWP Multi-Instancing, UWP console apps, and broader access to the file system. In this Ask the Admin, I’ll give you an overview of these new features and why Microsoft introduced them.
Microsoft has been slowly pushing forward with the Universal Windows Platform (UWP) app model to close the gap with legacy Win32 applications. In the latest update to Windows 10, three important changes bring UWP one step closer to that goal.
Multi-Instancing UWP Apps
The first, and possibly most important, is multi-instancing. Until now, UWP apps could only run multiple windows in a single process, which is difficult to manage and leads to reliability concerns. For example, if one window crashes, then it will bring down all the other app’s windows with it. Multi-instancing addresses this issue by allowing multiple instances of an app to open in separate processes.
In the Windows 10 April 2018 Update, if an instance of an app is running and a new activation request is made, by default a new instance of the app will be created. Before the April 2018 Update, if an app is already running and activated again, for example by a user clicking the app’s Start menu tile, then the activation calls the running instance of the app. It then decides how to handle the activation request. Developers can opt to create multi-instance ‘redirection’ UWP apps, where the app controls exactly how each instance is activated.
Microsoft has provided updated Visual Studio project templates for creating multi-instancing UWP apps. Developers that want to add basic multi-instancing to existing apps just need to add a few lines of code to the application’s manifest file. Most apps can simply opt-in to multi-instancing. But some apps, such as ones that assume it has exclusive access to a file or database, might need work before making the change.
For more technical details on multi-instancing UWP apps, see MSDN Magazine’s website here.
Console UWP Apps
Yes, you read that right. UWP apps are supposed to be touch-friendly GUI apps that work on different formfactors. At least that was Microsoft’s original plan. And while those dreams haven’t been abandoned entirely, Microsoft realizes that UWP apps are most likely to deploy on desktop editions of Windows.
Console UWP apps are exactly what you’d imagine. You can create a command-line tool that works with the console window for input and output. But why build a console UWP app? You would do this for the same reason you would build any UWP app, to take advantage of store deployment. This also includes updating and APPX packaging.
Microsoft has added a project template to Visual Studio to make it easy to get going. Console UWP apps can be started from the command prompt, a PowerShell console, or the Windows run box (WIN+R). As part of the work to support console UWP apps, developers can use System.Console APIs and many Win32 APIs.
UWP apps have traditionally been restricted to specific user folders, like My Documents, or to locations that users choose if the app opens the FilePicker dialog. As you can imagine, that model doesn’t work well for console apps. So as part of the development work to support console apps, Microsoft added broader file-system access for UWP.
Any UWP app that declares an AppExecutionAlias is given access to locations in the current working directory and everything below it. And like Win32 apps, UWP apps have the same level of access to the file system as the user running the app, so there still might be files and folders that users can’t access.
Alternatively, developers can declare a new capability (broadFileSystemAccess) in the app manifest to get broader file-system access. Declaring restricted capabilities in apps might mean that it takes longer to get approval before it appears in the Microsoft Store. If granted, this new capability will grant the application the same access to the file system as the user running the app.
Because broadFileSystemAccess capability gives much wider access to the file system than has been previously possible, developers must provide genuine reasons why an app needs access. Additionally, when an app that declares the broadFileSystemAccess capability is run for the first time, users must give explicit consent for the app to run. File access permissions can be revoked at any time in the Privacy section of the Settings app.
In this Ask the Admin, I explained three new features that aim to bring UWP apps closer to the functionality available for legacy Win32 apps.
Follow Russell on Twitter @smithrussell.