Skip to content

Commit 888221d

Browse files
manodasanW0x5bfa
authored andcommitted
Init
1 parent 28086b9 commit 888221d

2 files changed

Lines changed: 111 additions & 136 deletions

File tree

CONTRIBUTING.md

Lines changed: 83 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,120 @@
11
# C#/WinRT Contributor's Guide
22

3-
Below is our guidance for how to build the repo, report issues, propose new features, and submit contributions via Pull Requests (PRs).
3+
This guide explains how to report issues, propose features, build the repository, and submit PRs.
44

5-
## Building the C#/WinRT repo
5+
1. [Find or File an Issue First](#find-or-file-an-issue-first)
6+
2. [Working on a Fix or Feature After Approvals](#working-on-a-fix-or-feature-after-approvals)
7+
3. [Building the repo](#building-the-repo)
68

7-
C#/WinRT currently requires the following packages, or newer, to build:
9+
## Find or File an Issue First
810

9-
- [Visual Studio 17.0](https://visualstudio.microsoft.com/downloads/)
10-
- [.NET 8.0 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)
11-
- [nuget.exe 5.9](https://www.nuget.org/downloads)
12-
- Microsoft.WindowsAppSDK.Foundation 1.8.250831001
11+
Before starting any work to submit a PR, **find or file an issue first**. This ensures no duplicated effort and keeps collaboration efficient.
1312

14-
The [`build.cmd`](src/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.exe` and the .NET 6 SDK, configures the environment to use .NET 6 (creating a `global.json` if necessary), builds the compiler, and builds and executes the unit tests. To build C#/WinRT, follow these steps:
13+
Check both open and closed issues before filing a new one. If none matches your case, file a new issue.
1514

16-
- Open a Visual Studio Developer command prompt pointing at the repo.
17-
- Run `src\build.cmd`.
18-
- To launch the project in Visual Studio, run `devenv src\cswinrt.sln` from the same command prompt. This will inherit the necessary environment.
15+
### When to File an Issue
1916

20-
**Note:** By default, the projects for various [Projections](src/Projections) only generate source files for Release configurations, where `cswinrt.exe` can execute in seconds. To generate sources for the [Projections](src/Projections) projects on Debug configurations, set the project property `GenerateTestProjection` to `true`. This configuration permits a faster inner loop in Visual Studio. In either case, existing projection sources under the "Generated Files" folder will still be compiled into the projection assembly.
17+
* Unsure if it’s a bug or feature request
18+
*[File an Issue](https://github.com/microsoft/CsWinRT/issues/new/choose)
19+
* Have a question not answered in the docs
20+
*[Post a Discussion](https://github.com/microsoft/CsWinRT/discussions)
21+
* Want to propose or confirm a planned feature
22+
*[Post a Discussion](https://github.com/microsoft/CsWinRT/discussions)
2123

22-
### Customizing `build.cmd` options
23-
24-
There are several settings that can be set with `build.cmd` that you might not know about without studying the code. The build settings and defaults are as follows.
25-
26-
```cmd
27-
build.cmd [Platform] [Configuration] [VersionNumber] [VersionString] [AssemblyVersion]
28-
```
24+
### What to Describe
2925

30-
| Parameter | Value(s) |
31-
|-|-|
32-
| Platform | *x64 \| x86 | Default is `x64`
33-
| Configuration | *Release \| Debug |
34-
| VersionNumber | *0.0.0.0 |
35-
| VersionString | *0.0.0-private.0 |
36-
| AssemblyVersion | *0.0.0.0 |
37-
\*Default value
26+
* Versions of .NET, C#/WinRT, and SDK projections
27+
* Tools and IDEs used (e.g., VS 2022, VS Code)
28+
* Build version of Windows used
29+
* **Detailed reproduction steps** (most important)
30+
* Full error text or screenshots
31+
* Note if you plan to implement the fix/feature yourself
3832

39-
**Examples**
33+
> [!IMPORTANT]
34+
> **DO NOT** post "+1", "me too", or similar comments ー they just add noise to an issue.
35+
> If you don't have any additional info/context to add but would like to indicate that you're affected by the issue, upvote the original issue by reacting with 😊 or 👍 emoji and post your context if necessary. This way we can actually measure how impactful an issue is.
4036
41-
- Building in Release mode for platform x64, and creates a 0.0.0-private.0.nupkg
42-
```cmd
43-
build.cmd
44-
```
45-
- Building in Debug mode for platform x86, and creates a 0.0.0-private.0.nupkg
46-
```cmd
47-
build.cmd x86 Debug
48-
```
49-
- Building in Debug mode for platform x64, and creates a 2.0.0-mycswinrt.0.nupkg that has `WinRT.Runtime` with AssemblyVersion of 2.0.0.0
50-
```cmd
51-
build.cmd x64 Debug 2.0.0.0 2.0.0-mycswinrt.0 2.0.0.0
52-
```
53-
This is useful if you want to quickly confirm that your private .nupkg is being used by checking the `WinRT.Runtime` assembly version.
37+
## Working on a Fix or Feature After Approvals
5438

55-
## Before you start, file an issue
39+
### 1. Fork and Branch
5640

57-
Please follow this simple rule to help us eliminate any unnecessary wasted effort & frustration, and ensure an efficient and effective use of everyone's time - yours, ours, and other community members':
41+
After your proposal is discussed and approved:
5842

59-
> 👉 If you have a question, think you've discovered an issue, would like to propose a new feature, etc., then find/file an issue **BEFORE** starting work to fix/implement it.
43+
1. Fork the repo
44+
2. Clone your fork
45+
3. Create and push a feature branch
46+
4. Implement your changes
47+
5. Test your changes locally
48+
6. Submit a Pull Request (PR)
6049

61-
### Search Existing Issues First
50+
### 2. Agree with CLA
6251

63-
Before filing a new issue, search existing open and closed issues first: It is likely someone else has found the problem you're seeing, and someone may be working on or have already contributed a fix!
52+
Most contributions require signing a [Contributor License Agreement (CLA)](https://cla.opensource.microsoft.com), confirming that you own the rights to your contribution and grant Microsoft permission to use it.
6453

65-
If no existing item describes your issue/feature, great - please file a new issue:
54+
When you open a pull request, the CLA bot automatically checks whether a signature is required and updates the PR with a status or comment.
55+
Follow the bot’s instructions if prompted. You only need to complete this process once for all Microsoft repositories that use the CLA bot.
6656

67-
### File a New Issue
57+
### 3. Code Review
6858

69-
* Don't know whether you're reporting an issue or requesting a feature? File an issue
70-
* Have a question that you don't see answered in docs, videos, etc.? File an issue
71-
* Want to know if we're planning on building a particular feature? File an issue
72-
* Found an existing issue that describes yours? Great - upvote and add additional commentary / info / repro-steps / etc.
59+
Mark your PR as "Ready for Review" when it’s ready for feedback from the team and the community. It may take several review cycles to ensure correctness and stability.
7360

74-
### Include Issue Details
61+
### 4. Merge
7562

76-
**Please include as much information as possible in your issue**. The more information you provide, the more likely your issue/ask will be understood and implemented. Helpful information includes:
63+
After approvals, your PR will be merged into the main branch and automatically closed.
7764

78-
* What versions of .NET, C#/WinRT, and the SDK Projection you're using
79-
* What tools and apps you're using (e.g. VS 2019, VSCode, etc.)
80-
* What build of Windows your device is running
81-
* Don't assume we're experts in setting up YOUR environment and don't assume we are experts in YOUR workflow. Teach us to help you!
82-
* **We LOVE detailed repro steps!** What steps do we need to take to reproduce the issue? Assume we love to read repro steps. As much detail as you can stand is probably _barely_ enough detail for us!
83-
* Prefer error message text where possible or screenshots of errors if text cannot be captured
84-
* **If you intend to implement the fix/feature yourself then say so!** If you do not indicate otherwise we will assume that the issue is ours to solve, or may label the issue as `Help-Wanted`.
65+
Thank you in advance for your contribution!
8566

86-
### DO NOT post "+1" comments
67+
## Building the repo
8768

88-
> ⚠ DO NOT post "+1", "me too", or similar comments - they just add noise to an issue.
69+
### Prerequisites
8970

90-
If you don't have any additional info/context to add but would like to indicate that you're affected by the issue, upvote the original issue by clicking its [+😊] button and hitting 👍 (+1) icon. This way we can actually measure how impactful an issue is.
71+
- [Visual Studio 2026](https://visualstudio.microsoft.com/downloads/)
72+
- [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet)
9173

92-
---
74+
### Build steps
9375

94-
## Development
95-
96-
### Fork, Clone, Branch and Create your PR
76+
1. Open a Visual Studio Developer command prompt in the repo root.
77+
2. Run a script to install dependencies, set up the environment, build the compiler, and run unit tests.
78+
```
79+
src\build.cmd
80+
```
81+
3. (Optional) Open the solution in Visual Studio. This will inherit the necessary environment.
82+
```
83+
devenv src\cswinrt.slnx
84+
```
9785
98-
Once you've discussed your proposed feature/fix/etc. with a team member, and you've agreed on an approach or a spec has been written and approved, it's time to start development:
86+
> [!NOTE]
87+
> Projection projects under `src/Projections` only generate sources in `Release` by default. To generate them in `Debug`, set the property `GenerateTestProjection` to `true`. This configuration will enable a faster inner loop in Visual Studio. "Generated Files" remain under the Generated Files folder regardless of configuration.
9988
100-
1. Fork the repo if you haven't already
101-
1. Clone your fork locally
102-
1. Create & push a feature branch
103-
1. Create a Pull Request
104-
1. Work on your changes
89+
### Customizing `build.cmd` options
10590
106-
### Code Review
91+
You can specify platform, configuration, and version parameters:
10792
108-
When you'd like the team to take a look, (even if the work is not yet fully complete), mark the PR as 'Ready For Review' so that the team can review your work and provide comments, suggestions, and request changes. It may take several cycles, but the end result will be solid, testable, conformant code that is safe for us to merge.
93+
```cmd
94+
build.cmd [Platform] [Configuration] [VersionNumber] [VersionString] [AssemblyVersion]
95+
```
10996

110-
### Merge
97+
| Parameter | Values | Default
98+
|-|-|-|
99+
| Platform | `x64 \| x86` | `x64` |
100+
| Configuration | `Release \| Debug` | `Release` |
101+
| VersionNumber | \* | `0.0.0.0` |
102+
| VersionString | \* | `0.0.0-private.0` |
103+
| AssemblyVersion |\* | `0.0.0.0` |
111104

112-
Once your code has been reviewed and approved by the requisite number of team members, it will be merged into the master branch. Once merged, your PR will be automatically closed.
105+
Building in `Release` for `x64`, and creates `0.0.0-private.0.nupkg`
106+
```cmd
107+
build.cmd
108+
```
113109

114-
---
110+
Building in `Debug` for `x86`, and creates `0.0.0-private.0.nupkg`
111+
```cmd
112+
build.cmd x86 Debug
113+
```
115114

116-
## Thank you
115+
Building in `Debug` for `x64`, and creates `2.0.0-mycswinrt.0.nupkg` that has `WinRT.Runtime` with AssemblyVersion of `2.0.0.0`
116+
```cmd
117+
build.cmd x64 Debug 2.0.0.0 2.0.0-mycswinrt.0 2.0.0.0
118+
```
117119

118-
Thank you in advance for your contribution!
120+
This is useful if you want to quickly confirm that your private .nupkg is being used by checking the `WinRT.Runtime` assembly version.

README.md

Lines changed: 28 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,42 @@
1-
[![Build Status](https://dev.azure.com/microsoft/Dart/_apis/build/status%2FCsWinRT%20GitHub%20CI?branchName=master)](https://dev.azure.com/microsoft/Dart/_build/latest?definitionId=112455&branchName=master)
1+
<h1 align="center">C#/WinRT Language Projection</h1>
22

3-
# The C#/WinRT Language Projection
3+
<p align="center">
4+
<a style="text-decoration:none" href="https://www.nuget.org/packages/Microsoft.Windows.CsWinRT">
5+
<img src="https://img.shields.io/nuget/v/Microsoft.Windows.CsWinRT?label=nuget (stable)" alt="NuGet badge" /></a>
6+
<a style="text-decoration:none" href="https://www.nuget.org/packages/Microsoft.Windows.CsWinRT">
7+
<img src="https://img.shields.io/nuget/vpre/Microsoft.Windows.CsWinRT?label=nuget (preview)" alt="NuGet badge" /></a>
8+
</p>
49

5-
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.
10+
C#/WinRT provides **Windows Runtime (WinRT) API** projection support for C#. A *projection* is an adapter that lets developers use WinRT APIs naturally in their language of choice. The C#/WinRT projection abstracts interop details and maps WinRT types to their .NET equivalents, such as strings, URIs, value types, and generic collections.
611

7-
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](https://github.com/Microsoft/cppwinrt) 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.
12+
C#/WinRT includes tools that:
13+
- Generate C# source for consuming WinRT APIs from `*.winmd` files
14+
- Generate `*.winmd` files for authoring WinRT components
815

9-
## Motivation
16+
Generated C# source can be compiled into interop assemblies, similar to how [C++/WinRT](https://github.com/Microsoft/cppwinrt) produces headers for C++. This design removes the need for the C# compiler or .NET runtime to have built-in WinRT support.
1017

11-
[.NET Core](https://docs.microsoft.com/en-us/dotnet/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.
18+
## Getting started
1219

13-
[WinUI 3](https://github.com/Microsoft/microsoft-ui-xaml) 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.
20+
- [Usage guide](docs/usage.md)
21+
- [Customizing C#/WinRT](nuget/readme.md)
22+
- [NativeAOT and Trimming support](docs/aot-trimming.md)
23+
- [Authoring C#/WinRT components](docs/authoring.md)
24+
- [About WinRT.Host.dll](docs/hosting.md)
25+
- [C#/WinRT version history](docs/version-history.md)
26+
- [Repository structure](docs/structure.md)
27+
- [COM Interop guide](docs/interop.md)
28+
- Related projects
29+
- [xlang](https://github.com/microsoft/xlang)
30+
- [Windows App SDK](https://github.com/microsoft/WindowsAppSDK)
1431

15-
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.
16-
17-
## What's New
18-
19-
See our [release notes](https://github.com/microsoft/CsWinRT/releases) 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.
20-
21-
## Using C#/WinRT
22-
23-
Download the C#/WinRT NuGet package here: https://www.nuget.org/packages/Microsoft.Windows.CsWinRT/
24-
25-
You can also build a C#/WinRT package yourself from source: see our [Contributor's Guide](CONTRIBUTING.md) for more information on building the repo.
26-
27-
### Documentation
28-
29-
- [Usage guide](docs/usage.md) - usage guide for developers
30-
- [C#/WinRT NuGet properties](nuget/readme.md) - documentation on customizing C#/WinRT NuGet package properties
31-
- [Repository structure](docs/structure.md) - detailed breakdown of this repository
32-
- [COM Interop guide](docs/interop.md) - for recommendations on migrating from System.Runtime.InteropServices
33-
34-
For additional documentation and walkthroughs, visit <http://aka.ms/cswinrt>.
35-
36-
### C#/WinRT Architecture
37-
38-
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](https://docs.microsoft.com/dotnet/standard/native-interop/com-wrappers) lifetime management.
32+
For additional documentation and walkthroughs, visit https://aka.ms/cswinrt.
3933

4034
## Contributing
4135

42-
The C#/WinRT team welcomes feedback and contributions! There are several ways to contribute to the project:
43-
44-
- **[File a new issue](https://github.com/microsoft/CsWinRT/issues/new/choose)**<br>
45-
- **[Ask a question](https://github.com/microsoft/CsWinRT/discussions/categories/q-a)**<br>
46-
- **[Start a discussion](https://github.com/microsoft/CsWinRT/discussions)**<br>
47-
- **[Make a feature request](https://github.com/microsoft/CsWinRT/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)**<br>
48-
49-
We ask that **before you start work on a feature that you would like to contribute**, please read our [Contributor's Guide](CONTRIBUTING.md), which also includes steps on building the C#/WinRT repo.
50-
51-
## Related Projects
52-
53-
C#/WinRT is part of the [xlang](https://github.com/microsoft/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.
54-
55-
C#/WinRT is also part of the [Windows App SDK](https://github.com/microsoft/WindowsAppSDK) - 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](https://docs.microsoft.com/en-us/windows/apps/winui/), [WebView2](https://docs.microsoft.com/en-us/microsoft-edge/webview2/), [MSIX](https://docs.microsoft.com/en-us/windows/msix/overview), [C++/WinRT](https://github.com/microsoft/CppWinRT/), and [Rust/WinRT](https://github.com/microsoft/winrt-rs).
56-
57-
### License Info
58-
59-
Most contributions require you to agree to a
60-
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
61-
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
62-
63-
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.
36+
We welcome feedback and contributions! We ask that **before you start work on a feature that you would like to contribute**, please read our [Contributor's Guide](CONTRIBUTING.md).
6437

6538
## Code of Conduct
6639

6740
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
68-
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
69-
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
41+
42+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

0 commit comments

Comments
 (0)