Today, we are releasing huge updates to UWP for .NET developers. The really big improvement is adding support for .NET Standard 2.0. UWP developers now have access to ~ 20k more APIs. This release brings UWP to partity with the other .NET implementations that support .NET Standard 2.0.
You need to download Visual Studio 2017 15.4, also released today, to take advantage of these updates. You also need to be running on and targeting Windows 10 Fall Creators Update, which will be released later this month. .NET Standard 2.0 support for UWP required changes in Windows 10 that are shipping in Fall Creators Update. These changes established a new baseline for UWP tools.
Today’s release also includes many other important improvements, which will be covered later in the post. They are also detailed in the UWP .NET Release Notes.
Targeting Windows 10 Fall Creators Update
In order to use .NET Standard 2.0 in UWP, you need to target Fall Creators Update (FCU) as the minimum version of your UWP project. That’s because .NET Standard 2.0 contains many APIs that require FCU to make them work in the context of the UWP execution environment, specifically AppContainer.
If you create a new project, you’ll be prompted to select the Windows version you want to target:
You can also upgrade an existing project by right clicking your project and selecting Properties. On the Application tab, you can then select the Windows version using the same drop downs.
.NET Standard is a specification of APIs that all .NET implementations have to implement. UWP now has support for .NET Standard 2.0.
The key advantage of .NET Standard 2.0 is that it makes .NET implementations of .NET Standard much more similar to .NET Framework. With .NET Standard 2.0, about 20,000 more APIs become available compared to .NET Standard 1.6. The vast majority of them are existing .NET Framework APIs, which includes missing reflection APIs, non-generic collections,
DataSet, binary serialization, XML Schema, and many more. For a full list, take a look at the diff between .NET Standard 2.0 and .NET Standard 1.6.
This makes it much easier to port existing .NET Framework code to UWP. This includes both, copy & pasting existing code, but also extends to referencing existing .NET Framework binaries, via the compatibility mode. Here is an example of using
DataSet inside a UWP application:
For more details, check out my blog post on .NET Standard 2.0.
Using .NET Core 2.0 for Debugging
Visual Studio uses CoreCLR for UWP application debugging. It provides much faster build + debug startup time than .NET Native provides. Visual Studio has transitioned to using .NET Core 2.0 instead of a custom build of CoreCLR.
The use of .NET Core 2.0 should not be observable in most cases. The move to .NET Core 2.0 is important for two main reasons:
- .NET Core performance will improve the UWP application debugging experience.
- Increased alignment between .NET application types.
UWP apps use .NET Core for debug and .NET Native for release builds by default. There are important differences that you can observe between the two builds types. The most important differents are due to .NET Native being an ahead-of-time native compiler. You should consider switching the debug build to use .NET Native at some point in order to discover potential bugs or other application failures.
We added incremental build support for .NET Native in this release to improve the throughput of .NET Native builds. This new capability makes debugging with .NET Native much more approachable. The initial build for .NET Native is still long. Recall that incremental builds always have a baseline. After the first build, .NET Native builds are much faster. We still recommend using .NET Core for debug, but this new capability should be quite useful if you need it.
We hope that you enjoy using these improvements for UWP apps. You can now have access to many more APIs, can use .NET Standard 2.0 libraries and can much more easily migrate existing code into your UWP apps. Your Visual Studio debugging experience should be faster and more capable, and the apps you create should be faster and more stable.
This latest release is the largest one we’ve shipped since we first shipped .NET Native with Windows 10. We believe that it is a huge step forward. Please give us feedback and tell us where you would like to see additional improvements.