Built-in support for WinRT is removed from .NET
Built-in support for consumption of Windows runtime (WinRT) APIs in .NET is removed.
Previously, CoreCLR could consume Windows metadata (WinMD) files to active and consume WinRT types. Starting in .NET 5, CoreCLR can no longer consume WinMD files directly.
This breaking change was made for the following reasons:
- So WinRT can be developed and improved separately from the .NET runtime.
- For symmetry with interop systems provided for other operating systems, such as iOS and Android.
- To take advantage of other .NET features, such as C# features, intermediate language (IL) trimming, and ahead-of-time (AOT) compilation.
- To simplify the .NET runtime codebase.
Remove references to the Microsoft.Windows.SDK.Contracts package. Instead, specify the version of the Windows APIs that you want to access via the
TargetFrameworkproperty of the project. For example:
If you're consuming a third-party runtime component that's defined in a .winmd file, add a reference to the Microsoft.Windows.CsWinRT NuGet package. For information on how to generate the C# projection, see the C#/WinRT documentation.
For more information, see Call Windows Runtime APIs in desktop apps.
Submit and view feedback for