This post has been republished via RSS; it originally appeared at: Windows Blog.Today is the official GA release for .NET 5, and along with it we are excited to share the latest updates with our recent release of C#/WinRT version 1.0. C#/WinRT provides WinRT projection support for .NET 5 based apps. The Windows SDK leverages this technology and is now integrated with the .NET 5.0 SDK to expose Windows APIs through the new Target Framework Monikers. In addition to the Windows SDK support added for .NET 5, C#/WinRT itself allows component authors to build their own .NET 5 projections using the CsWinRT NuGet package. To use the latest runtime and SDK updates in .NET 5, install the following: CsWinRT Github repo.
Call Windows APIs with new TFMs in .NET 5C#/WinRT provides support for WinRT APIs in .NET 5 by generating Windows SDK projections and including them in the .NET 5.0 SDK along with a small runtime assembly. With this new support, Windows APIs should now be accessed using the new Target Framework Monikers feature. The new TFMs provide a simple and streamlined access to the Windows APIs in a .NET 5 app. The following TFMs and corresponding SDK versions are supported:
- net5.0-windows10.0.17763.0 (Windows 10, version 1809)
- net5.0-windows10.0.18362.0 (Windows 10, version 1903)
- net5.0-windows10.0.19041.0 (Windows 10, version 2004)
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>For more details on how to use Windows TFMs in your app, check out the blog post on Calling Windows APIs in .NET 5 as well as the developer docs for Windows desktop apps.
Latest Windows Runtime UpdatesVersion 1.0 of C#/WinRT includes the latest runtime updates that are shipped through our runtime assembly, winrt.runtime.dll, as part of the .NET 5.0 SDK. The runtime assembly and the Windows SDK projections are accessed through the .NET 5 TFMs mentioned above. Some of the latest .NET 5 features we have added include C# function pointers for improved performance and implementing natural C#-style casts. To learn more about these updates, take a look at the blog post on improvements in native code interop in .NET 5. We have made performance improvements and fixed several critical bugs raised by the team as well as from developer feedback through our repo. Some of these fixes include:
- Added projection support for ref const C# parameters
- Fixes for NullReferenceExceptions when using C# IDictionary objects
- Resolved issues with using WindowsRuntimeBufferExtensions methods
- Several bug-fixes involving InvalidCastExceptions