GithubHelp home page GithubHelp logo

00mjk / cswinrt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/cswinrt

0.0 0.0 0.0 3.03 MB

C# language projection for the Windows Runtime

License: MIT License

C++ 18.26% C 0.12% C# 81.06% Batchfile 0.47% PowerShell 0.09%

cswinrt's Introduction

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 that 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.

C#/WinRT Architecture

Component Authors

Component Authors need to build a C#/WinRT projection for .NET5+ targets.

Creating projection

Application Developers

.NET5+ apps reference the NuGet package, which pulls in the projection assembly instead of a winmd.

Adding projection

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 its .NET 5 release.

WinUI3.0 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, compatible down to .NET Standard 2.0.

Installing and running C#/WinRT

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

C#/WinRT currently requires the following packages, or newer, to build:

The build.cmd script takes care of all related configuration steps and is the simplest way to get started building C#/WinRT. It installs prerequisites such as nuget and the .NET 5 SDK, configures the environment to use .NET 5 (creating a global.json if necessary), builds the compiler, and builds and executes the unit tests. To build C#/WinRT, follow these steps:

  • Open a Visual Studio Developer command prompt pointing at the repo.
  • Run build.cmd.
  • To launch the project in Visual Studio, run devenv cswinrt.sln from the same command prompt. This will inherit the necessary environment.

Note: By default, projection projects only generate source files for Release configurations, where cswinrt.exe can execute in seconds. To generate projection sources for Debug configurations, set the project property GenerateTestProjection to 'true'. In either case, existing projection sources under the "Generated Files" folder will still be compiled into the projection assembly. This configuration permits a faster inner loop in Visual Studio.

What's New

CsWinRT v1.0 is our latest public release, and is compatible with the .NET 5 RTM SDK. We may have preview releases to address specific bug fixes before v1.1. Details on breaking changes and known issues can be found on the release notes page.

Developer Guidance

Please read the usage and repository structure docs for a detailed breakdown. For recommendations on migrating from System.Runtime.InteropServices, see the COM Interop guide. For additional documentation visit http://aka.ms/cswinrt.

Related Projects

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 Project Reunion - 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. Project Reunion combines Win32 native app capabilities with modern API usage techniques, so your apps light up everywhere your users are. Project Reunion also includes WinUI, WebView2, MSIX, C++/WinRT, and Rust/WinRT.

Contributing

File a new issue! This project welcomes contributions and suggestions of all types.

We ask that before you start work on a feature that you would like to contribute, please read our Contributor's Guide.

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 [email protected] with any additional questions or comments.

cswinrt's People

Contributors

scottj1s avatar jkoritzinsky avatar manodasanw avatar ujjwalchadha avatar j0shuams avatar angelazhangmsft avatar dunhor avatar benjkuhn avatar microsoftopensource avatar aaronrobinsonmsft avatar adambraden avatar kennykerr avatar stevenbrix avatar azchohfi avatar fabiant3 avatar karkarl avatar richlander avatar wjk avatar microsoft-github-operations[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.