Skip to content

Commit 89276ff

Browse files
Merge pull request #49067 from dotnet/main
Merge main into live
2 parents f3c00fd + d46cf09 commit 89276ff

File tree

22 files changed

+882
-59
lines changed

22 files changed

+882
-59
lines changed

.github/copilot-instructions.md

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,28 @@
11
# .NET Documentation Guidelines
22

3-
## Disclosure
3+
IMPORTANT: For any Markdown files generated by AI, always disclose that they were created with the assistance of AI. If missing, add the `ai-usage` frontmatter key/value pair:
44

5-
For any Markdown files generated by AI, always disclose that they were created with the assistance of AI. Add the following frontmatter key/value pair:
5+
- When reviewing a PR not created by AI:
66

7-
```markdown
8-
ai-usage: ai-generated
9-
```
7+
```markdown
8+
ai-usage: ai-assisted
9+
```
1010

11-
## Terminology
12-
13-
Unless otherwise specified, all .NET content refers to modern .NET (not .NET Framework).
14-
15-
## Writing Style
16-
17-
Follow [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-guide/welcome/) with these specifics:
11+
- When Copilot generates the article through GitHub without the use of a human:
1812

19-
### Voice and Tone
13+
```markdown
14+
ai-usage: ai-generated
15+
```
2016

21-
- Active voice, second person addressing reader directly.
22-
- Conversational tone with contractions.
23-
- Present tense for instructions/descriptions.
24-
- Imperative mood for instructions ("Call the method" not "You should call the method").
25-
- Use "might" instead of "may" for possibility.
26-
- Use "can" instead of "may" for permissible actions.
27-
- Avoid "we"/"our" referring to documentation authors or product teams.
17+
- When using an IDE with a human guiding AI:
2818

29-
### Structure and Format
19+
```markdown
20+
ai-usage: ai-assisted
21+
```
3022

31-
- Sentence case headings (no gerunds in titles).
32-
- Be concise, break up long sentences.
33-
- Oxford comma in lists.
34-
- Use bullets for unordered lists.
35-
- Number all ordered list items as "1." (not sequential numbering like "1.", "2.", "3.", etc.)
36-
- Ordered and unordered lists should use complete sentences with proper punctuation, ending with a period if it's more than three words.
37-
- Avoid "etc." or "and so on" - provide complete lists or use "for example".
38-
- Use "for example" instead of "e.g.".
39-
- Use "that is" instead of "i.e.".
40-
- No consecutive headings without content between them.
41-
42-
### Formatting Conventions
23+
## Terminology
4324

44-
- **Bold** for UI elements.
45-
- `Code style` for file names, folders, custom types, non-localizable text.
46-
- Raw URLs in angle brackets.
47-
- Use relative links for files in this repo.
48-
- Remove `https://learn.microsoft.com/en-us` from learn.microsoft.com links.
25+
Unless otherwise specified, all .NET content refers to modern .NET (not .NET Framework).
4926

5027
## API References
5128

@@ -72,7 +49,24 @@ For snippets >6 lines:
7249

7350
New Markdown files: lowercase with hyphens, omit filler words (the, a, etc.).
7451

52+
Examples:
53+
- ✅ Good: `getting-started-with-entity-framework.md`
54+
- ✅ Good: `configure-logging.md`
55+
- ✅ Good: `dependency-injection-guidelines.md`
56+
- ❌ Bad: `Getting-Started-With-The-Entity-Framework.md`
57+
- ❌ Bad: `configure_logging.md`
58+
- ❌ Bad: `DependencyInjectionGuidelines.md`
59+
7560
## Special Cases
7661

77-
- Breaking changes: Include directions from `.github/prompts/breaking-change.md`.
78-
- When you (Copilot) are assigned an issue in GitHub, after you've completed your work and the workflows (status checks) have run, check to make sure there are no build warnings under the OpenPublishing.Build status check. If there are, open the build report (under View Details) and resolve any build warnings you introduced.
62+
### Breaking Changes
63+
- Include directions from `.github/prompts/breaking-change.md`.
64+
65+
### GitHub Issue Assignment (AI Workflow)
66+
When assigned an issue or directly given a task in GitHub:
67+
1. Complete your work
68+
2. Wait for workflows (status checks) to run
69+
3. Check for build warnings in the OpenPublishing.Build status check
70+
4. If warnings exist:
71+
- Click "View Details" to open the build report
72+
- Resolve any build warnings you introduced
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
applyTo: docs/**/*.md,includes/**/*.md
3+
description: 'Follow these comprehensive writing style guidelines when creating or editing Markdown documentation. Apply active voice, conversational tone, Oxford commas, and specific formatting rules to ensure consistency and readability across all documentation.'
4+
---
5+
6+
# Markdown Writing Style Instructions
7+
8+
When writing or editing Markdown documentation, follow these style guidelines:
9+
10+
## Voice and Tone Requirements
11+
12+
ALWAYS write using:
13+
- Active voice with second person ("you")
14+
- Conversational tone with contractions
15+
- Present tense for instructions and descriptions
16+
- Imperative mood for instructions (write "Call the method" NOT "You should call the method")
17+
- "might" for possibility (NOT "may")
18+
- "can" for permissible actions (NOT "may")
19+
20+
NEVER use:
21+
- "we" or "our" when referring to documentation authors or product teams
22+
- Jargon or overly complex technical language
23+
- Weak phrases like "you can" or "there is/are/were" unless they add value
24+
25+
ALWAYS:
26+
- Write like you speak using everyday words
27+
- Create a friendly, informal tone
28+
- Start statements with verbs when possible
29+
30+
## Structure and Format Rules
31+
32+
### Headings and Content
33+
- Use sentence case headings (capitalize only first word and proper nouns)
34+
- Never use gerunds in titles
35+
- Never place consecutive headings without content between them
36+
- Lead with the most important information first
37+
- Front-load keywords for scanning
38+
39+
### Lists and Punctuation
40+
- **CRITICAL: Use Oxford comma in ALL lists (item1, item2, and item3) - NO EXCEPTIONS**
41+
- **MANDATORY: Number ordered lists using "1." for every item (NOT 1., 2., 3.) - ALWAYS USE "1."**
42+
- **REQUIRED: Use bullets for unordered lists - NEVER use numbers for unordered content**
43+
- **ESSENTIAL: Write complete sentences in lists with proper punctuation**
44+
- **MUST: End list items with periods if more than three words - THIS IS NON-NEGOTIABLE**
45+
- Skip end punctuation on titles, headings, and UI elements (3 words or fewer)
46+
47+
### Spacing and Layout
48+
- Add blank lines around Markdown elements (but don't add extra if they exist)
49+
- Use only one space after periods, question marks, and colons
50+
- Use no spaces around dashes (word—word)
51+
- Break up long sentences for clarity
52+
53+
### Prohibited Terms
54+
- Never write "etc." or "and so on" - provide complete lists or use "for example"
55+
- Use "for example" instead of "e.g."
56+
- Use "that is" instead of "i.e."
57+
58+
## Formatting Conventions
59+
60+
Apply these formatting rules:
61+
- **Bold text** for UI elements
62+
- `Code style` for file names, folders, custom types, and non-localizable text
63+
- Raw URLs in angle brackets
64+
- Relative links for files in this repository
65+
- Remove `https://learn.microsoft.com/en-us` from Microsoft Learn links
66+
67+
## Word Choice Requirements
68+
69+
### Verb Selection
70+
- Choose simple verbs without modifiers
71+
- Avoid weak verbs: "be," "have," "make," "do"
72+
- Use precise verbs (write "tell" NOT "inform")
73+
74+
### Conciseness Rules
75+
- Use one word instead of multiple when possible (write "to" NOT "in order to")
76+
- Choose words with one clear meaning (write "because" NOT "since" for causation)
77+
- Omit unnecessary adverbs unless critical to meaning
78+
- Use one term consistently for each concept
79+
80+
### Contraction Guidelines
81+
- Use common contractions: "it's," "you're," "that's," "don't"
82+
- Avoid ambiguous contractions: "there'd," "it'll," "they'd"
83+
- Never form contractions from noun + verb (avoid "Microsoft's developing")
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
description: Migrate code from the old ~/samples/snippets/ location to the relative ./snippets location.
3+
---
4+
5+
# Migrate code snippets
6+
7+
**IMPORTANT**: Unless otherwise asked to, **only** edit the article file in context. At the end of your operations you may ask for permission to edit other articles referencing the same snippets.
8+
9+
## Repository structure for code snippets
10+
11+
**IMPORTANT**: This repository has TWO different locations for code snippets:
12+
13+
### Old location (legacy - to be migrated FROM)
14+
- Path: `~/samples/snippets/`
15+
- Example: `~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/CS/form1.cs`
16+
- Status: Legacy, should be migrated to new location
17+
18+
### New location (current standard - migrate TO)
19+
- Path pattern: `./snippets/{doc-file}/{code-language}/`
20+
- Example: `./snippets/how-to-add-data-to-the-clipboard/csharp/form1.cs`
21+
22+
**Path components explained:**
23+
- `{doc-file}`: The markdown article filename WITHOUT the `.md` extension
24+
- Example: For article `how-to-add-data-to-the-clipboard.md` → use `how-to-add-data-to-the-clipboard`
25+
- `{code-language}`:
26+
- `csharp`: For C# code
27+
- `vb`: For Visual Basic code
28+
29+
## Legacy code characteristics (migrate FROM these)
30+
31+
**Location**: `~/samples/snippets/` folder
32+
**Problems with legacy code:**
33+
- Usually for .NET Framework (outdated)
34+
- Often incomplete or non-compilable
35+
- May lack project files
36+
- Uses outdated syntax and patterns
37+
38+
**Legacy article references look like this:**
39+
```markdown
40+
[!code-{code-language}[description](~/samples/snippets/{path-to-file}#{snippet-identifier})]
41+
```
42+
It's possible that the reference was already migrated, but the code wasn't, which looks like this:
43+
```markdown
44+
:::code language="{code-language}" source="~/samples/snippets/{path-to-file}" id="{snippet-identifier}":::
45+
```
46+
Based on the {path-to-file} you can determine if it's in the old system or not.
47+
48+
## Current code requirements (migrate TO these)
49+
50+
**Location**: `./snippets/{doc-file}/{code-language}/`
51+
52+
**Requirements for current code standards:**
53+
- ✅ MUST be complete and compilable
54+
- ✅ MUST include a project file
55+
- ✅ MUST target appropriate .NET version (see targeting rules below)
56+
- ✅ MUST provide BOTH C# and Visual Basic versions
57+
- ✅ MUST use appropriate syntax for the target framework
58+
- ✅ MUST use meaningful, descriptive snippet identifiers in CamelCase format
59+
- **Examples** of good snippet identifiers: `BasicClipboardData`, `CustomDataFormat`, `ClipboardImageHandling`
60+
- **Avoid** simplistic identifiers like `1`, `2`, `code1`, or `snippet1`
61+
62+
**Current article references look like this:**
63+
```markdown
64+
:::code language="{code-language}" source="{file-path}" id="{snippet-identifier}":::
65+
```
66+
67+
**Framework targeting rules:**
68+
- **Migration vs. Modernization**:
69+
- **Migration**: Move code to new location with minimal changes
70+
- **Modernization**: Update code to use latest .NET features and best practices
71+
- **When to modernize**: Unless told not to modernize, always modernize from .NET Framework to the latest .NET
72+
73+
## Migration steps (follow in order)
74+
75+
**WHEN TO MIGRATE**: Migrate code when you encounter articles with references to `~/samples/snippets/` paths.
76+
77+
**STEP-BY-STEP PROCESS:**
78+
79+
### 1. Analyze existing code and article context
80+
- **Find**: Locate the legacy snippet file in `~/samples/snippets/`
81+
- **Identify**: Determine the programming language (C# or Visual Basic)
82+
- **Extract**: Note the snippet identifier used in the article reference
83+
84+
### 2. Create new folder structure
85+
- **Pattern**: `./snippets/{doc-file}/{code-language}/`
86+
- **Example**: For article `clipboard-operations.md` → create `./snippets/clipboard-operations/csharp/`
87+
88+
### 3. Migrate and update code
89+
- **Copy**: Copy only the snippet code (and any supporting code to compile the snippet) to the new location
90+
- **Complete**: Ensure code is fully functional and compilable
91+
- **Project file**: Create or update project file with appropriate target framework
92+
93+
### 4. Create both language versions
94+
- **Requirement**: MUST provide both C# and Visual Basic versions
95+
- **C# path**: `./snippets/{doc-file}/csharp/`
96+
- **VB path**: `./snippets/{doc-file}/vb/`
97+
98+
### 5. Update article references
99+
- **Replace**: Change from legacy `[!code-...]` format to modern `:::code...:::` format
100+
- **Before**: `[!code-csharp[description](~/samples/snippets/path/file.cs#snippet1)]`
101+
- **After**: `:::code language="csharp" source="./snippets/doc-name/csharp/file.cs" id="BasicClipboardData":::`
102+
- **Note**: Use meaningful CamelCase identifiers instead of simple numbers
103+
104+
### 6. Validate
105+
- **Build**: Ensure all code compiles successfully
106+
- **Test**: Verify snippet references work in the article
107+
108+
### 7. Delete
109+
- **Identify**:
110+
- Check if the old snippet file is used by any other articles
111+
- Some articles may use a relative path to the `samples` folder, so simply search for links to `samples/snippets/...`
112+
- Be confident that all legacy snippets use a `samples/snippets` folder structure
113+
- **Delete**: If old snippet is no longer used by any article, delete it.
114+
115+
## Common mistakes to avoid
116+
117+
-**Don't** assume all code needs to be modernized - check article context first
118+
-**Don't** modernize .NET Framework-specific articles unless specifically requested
119+
-**Don't** forget to create both C# and VB versions
120+
-**Don't** forget to update ALL article references to the migrated code
121+
-**Don't** leave incomplete or non-compilable code

0 commit comments

Comments
 (0)