Repository navigation
Description
We've found that keeping snippet (code) projects in a different repository than the articles where they are includes introduces unnecessary friction in updating articles.
So, we plan to move snippets into the dotnet/docs and dotnet/dotnet-api-docs repositorites.
The dotnet/samples repository will be the home of larger scenario-based samples that may be referenced from tutorials or other long-form explorations. In addition, the samples in the dotnet/samples repository are likely candidates for the samples repository.
Task plan
- Make sure all included snippets are in the /snippets folder in the dotnet/samples repository.
- Update all snippet references to the /samples/snippets folder, while referencing the snippets in the dotnet/samples repository.
- Move all snippets into dotnet/docs/samples/snippets and dotnet/dotnet-api-docs/samples/snippets as one massive PR (each repo).
- Remove the samples repo dependency, and fix build errors.
- Remove the /snippets content in the dotnet/samples repo.
- Update the contributor guide with the snippet and sample guidelines below.
- Remove unreferenced snippets in dotnet/dotnet-api-docs/snippets. (Leverage the clean-repo tool for this task)
- Remove unreferenced snippets in dotnet/docs/snippets. (Leverage the clean-repo tool for this task)
- We configure samples CI on the conceptual and API reference repositories.
- Add dependabot to the docs and dotnet-api-docs repositories.
- After that task is completed, any new significant edits should move snippets into the correct folder structure in the content repo (see below).
- All samples remaining in the samples repository could be configured for the samples browser.
Note that we will be concurrently enabling .NET Interactive (formerly known as Try.NET) for samples. That work should be done in separate PRs from moving samples and snippets into a new repo or folder structure.
Guidelines for snippet projects
- They are projects (not solutions), and the
.slnfile is not checked in. (There are exceptions for multi-project tutorials.) - Language specific projects are in sibling folders using names following our inline code convention:
csharp,fsharp, andvb. These folders are not needed in the language guide area, where only one language is assumed. - When multiple versions of a project are needed to represent different steps in a tutorial, inline code can (maybe should) be used for interim steps. Only the final version is included using the include syntax.
For API reference, the repository will have a snippets folder at the root of the repository. Each project will be in a sub-folder that matches the sub-folder path for the associated XML file where the snippet is included. For example, snippets used in ~/xml/System.Collections.Generic/List`1.xml would be stored in ~/snippets/System.Collections.Generic/List`1 folder. This makes it easy to map between code and article.
For conceptual, we would put the project(s) in a snippets subfolder. The snippets subfolder should be in the same folder as the article by default. Where a snippets project contains code used in multiple articles, the snippets folder should be in the nearest parent folder of all relevant articles. This makes it easy for us to navigate from an article to a snippet. Where snippet projects map to a single article, the reverse mapping is easy. Where snippet projects contain code from multiple articles, search functions in VS code can be used to find all locations where snippets are used.
Guidelines for samples projects
Samples should be stored in folders that represent the area where a sample is referenced in articles. In most cases, this will map to the top 2 or 3 folder levels in the conceptual repo.
The next level folder should map to the sample name. Under that folder, different versions can be stored as needed for different steps of the source article.
Activity
tdykstra commentedon Mar 3, 2020
The plan for the new folder structure that we’re moving to after the initial move-everything-at-once stage says put snippets folder in the same folder as the article. Some folders have lots of articles, and we wouldn’t want one folder for all of the snippet projects. E.g. standard/base-types has a couple dozen articles.
Suggestion -- under snippets use a folder named after the article:
BillWagner commentedon May 4, 2020
Update from meeting with @Thraka on 5/4:
Next steps:
// <snippet>comments and#region snippet_areas from all samples.BillWagner commentedon May 12, 2020
Fixed by MicrosoftDocs/Contribute#394