This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Thank you for your interest in contributing to the .NET documentation!
This document covers the process for contributing to the articles and code samples that are hosted on the.NET documentation site. Contributions may be as simple as typo corrections or as complex as new articles.
The .NET documentation site is built from multiple repositories. These are just some of them:
We appreciate community contributions to documentation. The following list shows some guiding rules to keep in mind when you're contributing to .NET documentation:
Following these guidelines will ensure a better experience for you and for us.
Step 1: If you're interested in writing new content or in thoroughly revising existing content, open anissue describing what you want to do. The content inside thedocs folder is organized into sections that are reflected in the table of contents (TOC). Define where the topic will be located in the TOC. Get feedback on your proposal.
-or-
Choose an existing issue and address it. You can look at ouropen issues list and volunteer to work on the ones you're interested in:
When you find an issue to work on, add a comment to ask if it's open.
Once you've picked a task to work on,create a GitHub account and move on to Step 2.
Step 2: Fork the/dotnet/docs repo (or whichever repo you're contributing to) as needed and create a branch for your changes.
For small changes, seeEdit in the browser.
Step 3: Make the changes on this new branch.
If it's a new topic, you can use thistemplate file as your starting point. It contains the writing guidelines and also explains the metadata required for each article, such as author information. For more information on the Markdown syntax used in Microsoft Learn content, seeMarkdown reference.
Navigate to the folder that corresponds to the TOC location determined for your article in Step 1. That folder contains the Markdown files for all articles in that section. If necessary, create a new folder to place the files for your content. The main article for that section is calledindex.md.
For images and other static resources, create a subfolder calledmedia inside the folder that contains your article, if it doesn't already exist. Inside themedia folder, create a subfolder with the article name (except for the index file). For more information about where to place your files, see theExample folder structure section.
Don't include code inline in the article, unless you're demonstrating a construct that doesn't compile. Instead, use acode snippets project and include the code using the code extension. That ensures that your sample code is validated by our CI system.
Forcode snippets, create a subfolder calledsnippets inside the folder that contains your article, if it doesn't already exist. Inside thesnippets folder, create a subfolder with the article name. In most cases, you'll have code snippets for all three of the main .NET languages, C#, F#, and Visual Basic. In that case, create subfolders namedcsharp,fsharp, andvb for each of the three projects. If you're creating a snippet for an article under thedocs/csharp,docs/fsharp, ordocs/visual-basic folders, the snippet will only be in one language so you can omit the language subfolder. For more information about where to place your files, see theExample folder structure section.
Code snippets are small, focused examples of code that demonstrate the concepts covered in an article. Larger programs intended for download and exploration should be located in thedotnet/samples repository. Full samples are covered in the section onContributing to samples.
Step 4: Submit a pull request (PR) from your branch to the default branch.
Important
The comment automation functionality is not available on any of the .NET docs repositories at this time. Members of the .NET docs team will review and merge your PR.
Each PR should usually address one issue at a time, unless multiple issues are related to the same PR fix. The PR can modify one or multiple files. If you're addressing multiple fixes on different files, separate PRs are preferred.
If your PR fixes an existing issue, add theFixes #Issue_Number keyword to the PR description. That way, the issue is automatically closed when the PR is merged. For more information, seeLinking a pull request to an issue using a keyword.
The .NET team will review your PR and let you know if there are any other updates/changes necessary in order to approve it.
Step 5: Make any necessary updates to your branch as discussed with the team.
The maintainers will merge your PR into the default branch once feedback has been applied and your change is approved.
We regularly push all commits from default branch into the live branch and then you'll be able to see your contribution live in the.NET documentation. We typically publish daily during the work week.
docs /about /core /porting porting-overview.md /media /porting-overview portability_report.png /shared ... /snippets /porting-overview /csharp porting.csproj porting-overview.cs Program.cs /fsharp porting.fsproj porting-overview.fs Program.fs /vb porting.vbproj porting-overview.vb Program.vb /shared /csharp ... /fsharp ... /vb ...Note
The language folders under snippets are not needed in the language guide area, where only one language is assumed. For example, in the C# guide, it's assumed that all snippets are C#.
The structure shown above includes one image,portability_report.png, and three code projects that includecode snippets that are included in theporting-overview.md article.
Thesnippets/shared folder is used for snippets that may span multiple articles within the same parent folder, such as theporting folder in the previous example. Only use theshared folder when you have a specific reason to do so, such as XAML code that's referenced by multiple articles, yet can't compile in thearticle-specific folder.
Media can also be shared across articles when those articles are in the same parent folder, such as theporting folder in the previous example. Thisshared folder should be avoided if possible, and only used when it makes sense. For example, it may make sense to share a common loading screen for the app being demonstrated, or share Visual Studio dialogs that are reused across multiple articles.
Important
For historical reasons, many of the included snippets are stored under the/samples folder in thedotnet/docs repository. If you're making major changes to an article, those snippets should be moved to the new structure. However, don't worry about moving snippets for small changes.
We make the following distinction for code that supports our content:
Samples are stored in thedotnet/samples repository. We are working toward a model where our samples folder structure matches our docs folder structure. Standards that we follow are:
In addition, all samples under thecore andstandard folders should build and run on all platforms supported by .NET Core. Our CI build system will enforce that. The top levelframework folder contains samples that are only built and validated on Windows.
Sample projects should build and run on the widest set of platforms possible for the given sample. In practice, that means building .NET Core-based console applications where possible. Samples that are specific to the web or a UI framework should add those tools as needed. Examples include web applications, mobile apps, WPF or WinForms apps, and so on.
We are working toward having a CI system in place for all code. When you make any updates to samples, make sure each update is part of a buildable project. Ideally, add tests for correctness on samples as well.
Each complete sample that you create should contain areadme.md file. This file should contain a short description of the sample (one or two paragraphs). Yourreadme.md should tell readers what they will learn by exploring this sample. Thereadme.md file should also contain a link to the live document on the.NET documentation site. To determine where a given file in the repository maps to that site, replace/docs in the repository path withhttps://learn.microsoft.com/dotnet.
Your topic will also contain links to the sample. Link directly to the sample's folder on GitHub.
Samples are full programs and libraries meant for download. They may be small in scope, but they demonstrate concepts in a manner that enables people to explore and experiment on their own. The guidelines for samples ensure readers can download and explore. Examine theParallel LINQ (PLINQ) samples as an example of each of the guidelines.
Your samplemust be part of a buildable project. Where possible, the projects should build on all platforms supported by .NET Core. Exceptions to this are samples that demonstrate a platform specific feature or platform specific tool.
Your sample should conform to theruntime coding style to maintain consistency.
Additionally, we prefer the use ofstatic methods rather than instance methods when demonstrating something that doesn't require instantiating a new object.
Your sample should includeappropriate exception handling. It should handle all exceptions that are likely to be thrown in the context of the sample. For example, a sample that calls theConsole.ReadLine method to retrieve user input should use appropriate exception handling when the input string is passed as an argument to a method. Similarly, if your sample expects a method call to fail, the resulting exception must be handled. Always handle the specific exceptions thrown by the method, rather than base class exceptions such asException orSystemException.
To create a sample:
File anissue or add a comment to an existing one that you are working on it.
Write the topic that explains the concepts demonstrated in your sample (example:docs/standard/linq/where-clause.md).
Write your sample (example:WhereClause-Sample1.cs).
Create a Program.cs with a Main entry point that calls your samples. If there is already one there, add the call to your sample:
public class Program{ public void Main(string[] args) { WhereClause1.QuerySyntaxExample(); // Add the method syntax as an example. WhereClause1.MethodSyntaxExample(); }}You build any .NET snippet or sample using the .NET CLI, which can be installed withthe .NET SDK. To build and run your sample:
Go to the sample folder and build to check for errors:
dotnet buildRun your sample:
dotnet runAdd a readme.md to the root directory of your sample.
This should include a brief description of the code, and refer people to the article that references the sample. The top of thereadme.md must have the metadata required for thesamples browser. The header block should contain the following fields:
---name: "really cool sample"description: "Learn everything about this really cool sample."page_type: samplelanguages: - csharp - fsharp - vbnetproducts: - dotnet-core - dotnet - dotnet-standard - aspnet - aspnet-core - ef-core---languages collection should include only those languages available for your sample.products collection should include only those products relevant to your sample.Except where noted, all samples build from the command line on any platform supported by .NET. There are a few samples that are specific to Visual Studio and require Visual Studio 2017 or later. In addition, some samples show platform specific features and will require a specific platform. Other samples and snippets require the .NET Framework and will run on Windows platforms, and will need the Developer Pack for the target Framework version.
All snippets included in an article use alanguage tag to indicate the source language. Short code snippets in C# can use thecsharp-interactive language tag to specify a C# snippet that runs in the browser. (Inline code snippets use thecsharp-interactive tag, for snippets included from source, use thecode-csharp-interactive tag.) These code snippets display acode window and anoutput window in the article. Theoutput window displays any output from executing the interactive code once the user has run the snippet.
The C# interactive experience changes how we work with snippets. Visitors can run the snippet to see the results. A number of factors help determine if the snippet or corresponding text should include information about the output.
Note
You might notice that some of the topics are not currently following all the guidelines specified here. We're working towards achieving consistency throughout the site. Check the list ofopen issues we're currently tracking for that specific goal.
Contributions for Machine Translated (MT) content are currently not accepted. In an effort to improve the quality of MT content, we've transitioned to a Neural MT engine. We accept and encourage contributions for Human Translated (HT) content, which is used to train the Neural MT engine. So over time, contributions to HT content will improve the quality of both HT and MT. MT topics will have a disclaimer stating that part of the topic may be MT, and theEdit button won't be displayed, as editing is disabled.
Note
Most localized documentation doesn't offer the ability to edit or provide feedback through GitHub. To provide feedback on localized content, usehttps://aka.ms/provide-feedback form.
You must sign the.NET Foundation Contribution License Agreement (CLA) before your PR is merged. This is a one-time requirement for projects in the .NET Foundation. You can read more aboutContribution License Agreements (CLA) on Wikipedia.
The agreement:.NET Foundation Contributor License Agreement (CLA)
You don't have to sign the agreement up-front. You can clone, fork, and submit your PR as usual. When your PR is created, it is classified by a CLA bot. If the change is small (for example, you fixed a typo), then the PR is labeled withcla-not-required. Otherwise, it's classified ascla-required. Once you signed the CLA, the current and all future pull requests are labeled ascla-signed.
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?