Skip to main content
November 10, 2020

Announcing C#/WinRT Version 1.0 with the .NET 5 GA Release

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:

You can stay updated on the latest work with C#/WinRT by visiting the CsWinRT Github repo.

Call Windows APIs with new TFMs in .NET 5

C#/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)

Note that the SDK version in the TFM is the Windows SDK version used to build your app, not the minimum OS version that your app will run on. The new TFMs in .NET 5 can be used in your project file or NuGet package generation, and this is the recommended method for targeting Windows in .NET 5 going forwards. To use TFMs in your project, simply add the following line of code to your project file with the desired SDK version:


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 Updates

Version 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

We have also addressed several bugs with WinUI, which uses C#/WinRT projections for their framework. Due to the nature of these recent changes, all component libraries and apps that use C#/WinRT or the Windows APIs must update to the .NET 5 GA release. For a full list of changes between .NET 5 RC2 and RTM, please refer to the v1.0 release on our Github repo.

C#/WinRT Projection Support for Component Authors

The C#/WinRT project provides support for component authors to build C# projection assemblies of their components which can then be consumed by C# app developers. By referencing the CsWinRT NuGet package, component authors can generate an assembly using our improved project tooling in Visual Studio.

An end-to-end sample has been added to our repo showing how to generate a .NET 5 projection from a C++/WinRT component, and how to distribute and consume the projection assembly as a NuGet package. This walkthrough of the sample in the C#/WinRT docs provides more details. You can read more about the tooling experience for generating a projection in the last C#/WinRT blog post.


C#/WinRT has enabled .NET 5 to remove built-in WinRT support so that the WinRT ecosystem and .NET runtime can now innovate independently. We have also provided the tools for component authors to build C# projection assemblies for their .NET 5 consumers to use.

Up next for the team, we are working on authoring support for C# .NET 5 developers to create their own C#/WinRT components. These new capabilities will be available in a future release of C#/WinRT—keep up to date with the latest changes on the CSWinRT repo.