C# language projection for the Windows Runtime
Перейти к файлу
Manodasan Wignarajah 34d8d54cd2
Fix issue in WPF scenarios where our source generator was getting included twice. (#1731)
2024-09-05 01:14:58 -07:00
.config Update baseline (#1615) 2024-05-14 21:53:17 -07:00
.github/ISSUE_TEMPLATE Link to Github discussions and update readme for contributing (#1035) 2021-11-01 08:23:08 -07:00
build/AzurePipelineTemplates Add NuGet.config (#1728) 2024-08-29 17:55:08 -07:00
docs Update docs (#1723) 2024-08-26 13:39:39 -07:00
eng/common Static YML build pipeline (#1065) 2021-12-16 13:42:58 -08:00
nuget Fix issue in WPF scenarios where our source generator was getting included twice. (#1731) 2024-09-05 01:14:58 -07:00
src Fix source generator issues (#1732) 2024-09-04 23:54:58 -07:00
.gitignore ADO Pipeline Variables (#1080) 2022-01-19 16:09:24 -08:00
CODE_OF_CONDUCT.md Initial commit 2019-10-03 15:45:39 -07:00
CONTRIBUTING.md Clean up .NET 5 references and update to WinAppSDK projection for testing (#1261) 2022-10-25 16:03:47 -07:00
LICENSE Initial commit 2019-10-03 15:45:40 -07:00
README.md Update baseline and pipeline badge (#1405) 2023-12-02 20:50:28 -08:00
SECURITY.md Initial commit 2019-10-03 15:45:42 -07:00
nuget.config Add NuGet.config (#1728) 2024-08-29 17:55:08 -07:00

README.md

Build Status

The C#/WinRT Language Projection

C#/WinRT provides Windows Runtime (WinRT) projection support for the C# language. A "projection" is an adapter that enables programming the WinRT APIs in a natural and familiar way for the target language. The C#/WinRT projection hides the details of interop between C# and WinRT interfaces, and provides mappings of many WinRT types to appropriate .NET equivalents, such as strings, URIs, common value types, and generic collections.

WinRT APIs are defined in *.winmd format, and C#/WinRT includes tooling that generates C# code for consumption scenarios, or generates a *.winmd for authoring scenarios. Generated C# source code can be compiled into interop assemblies, similar to how C++/WinRT generates headers for the C++ language projection. This means that neither the C# compiler nor the .NET Runtime require built-in knowledge of WinRT any longer.

Motivation

.NET Core is the focus for the .NET platform. It is an open-source, cross-platform runtime that can be used to build device, cloud, and IoT applications. Previous versions of .NET Framework and .NET Core have built-in knowledge of WinRT which is a Windows-specific technology. By lifting this projection support out of the compiler and runtime, we are supporting efforts to make .NET more efficient for .NET 5 onwards.

WinUI 3 is the effort to lift official native Microsoft UI controls and features out of the operating system, so app developers can use the latest controls and visuals on any in-market version of the OS. C#/WinRT is needed to support the changes required for lifting the XAML APIs out of Windows.UI.XAML and into Microsoft.UI.XAML.

However, C#/WinRT is a general effort and is intended to support other scenarios and versions of the .NET runtime. While our focus is on supporting .NET 5, we aspire to generate projections that are compatible down to .NET Standard 2.0. Please refer to our issues backlog for more information.

What's New

See our release notes for the latest C#/WinRT releases and corresponding .NET SDK versions. C#/WinRT runtime and Windows SDK projection updates typically become available in a future .NET SDK update, which follows a monthly release cadence. We also make updates to the C#/WinRT tool itself, which are shipped through the C#/WinRT NuGet package. Details on breaking changes and specific issues can be found in the releases notes.

Using C#/WinRT

Download the C#/WinRT NuGet package here: https://www.nuget.org/packages/Microsoft.Windows.CsWinRT/

You can also build a C#/WinRT package yourself from source: see our Contributor's Guide for more information on building the repo.

Documentation

For additional documentation and walkthroughs, visit http://aka.ms/cswinrt.

C#/WinRT Architecture

The C#/WinRT runtime assembly, WinRT.Runtime.dll, is required by all C#/WinRT assemblies. It provides an abstraction layer over the .NET runtime, supporting .NET 5+. The runtime assembly implements several features for all projected C#/WinRT types, including WinRT activation, marshaling logic, and COM wrapper lifetime management.

Contributing

The C#/WinRT team welcomes feedback and contributions! There are several ways to contribute to the project:

We ask that before you start work on a feature that you would like to contribute, please read our Contributor's Guide, which also includes steps on building the C#/WinRT repo.

C#/WinRT is part of the xlang family of projects that help developers create APIs that can run on multiple platforms and be used with a variety of languages. The mission of C#/WinRT is not to support cross-platform execution directly, but to support the cross-platform goals of .NET Core.

C#/WinRT is also part of the Windows App SDK - a set of libraries, frameworks, components, and tools that you can use in your apps to access powerful platform functionality across many versions of Windows. The Windows App SDK combines Win32 native app capabilities with modern API usage techniques, so your apps light up everywhere your users are. The Windows App SDK also includes WinUI, WebView2, MSIX, C++/WinRT, and Rust/WinRT.

License Info

Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.