Skip to content
Open
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
e9cd131
Update base copilot instructions
adegeo Sep 25, 2025
1144ba5
Create project folder with supporting materials
adegeo Sep 25, 2025
c361a6a
Generate a plan as an instructions file based on the supporting infor…
adegeo Sep 25, 2025
01df98b
Phase 1 article: Initial
adegeo Sep 25, 2025
6713a46
Phase 1 article: Expand plan in the sections
adegeo Sep 25, 2025
23ddfb9
Phase 1 article: Query LLM about best way to communicate; move to HTM…
adegeo Sep 25, 2025
4792726
Phase 1 article: Intro/Prereqs first draft
adegeo Sep 25, 2025
03ac47f
Phase 1 article: Intro/Prereqs final draft (3 iterations)
adegeo Sep 25, 2025
be5f30e
Add additional resource to instructions
adegeo Sep 25, 2025
3e93a61
Phase 1 article: Breaking changes section
adegeo Sep 26, 2025
53b9e8c
Move plan file
adegeo Sep 26, 2025
54b7241
Phase 1 article: Add summary section
adegeo Sep 26, 2025
6e98618
Phase 1 article: Finish 2 more sections
adegeo Sep 26, 2025
b9db3a4
Phase 1 article: Update prereqs
adegeo Sep 26, 2025
64a8c2e
Phase 1 article: Remove sections I think are already covered well enough
adegeo Sep 26, 2025
4d360c2
Phase 1 article: Finish Enable BinaryFormatter support section
adegeo Sep 26, 2025
0bd9fea
Phase 1 article: Custom types section
adegeo Sep 26, 2025
3e19157
Phase 1 article: Make intro better
adegeo Sep 26, 2025
1b392ba
Phase 1: article: Copilot section
adegeo Sep 26, 2025
d7b5a93
Phase 1 article: Edit pass 1
adegeo Sep 26, 2025
599523b
Phase 1 article: Edit pass 2 (claude)
adegeo Sep 26, 2025
3d0deca
Phase 1 complete
adegeo Sep 26, 2025
fc4c113
Fix build errs
adegeo Sep 26, 2025
e65b2df
Phase 2.1: Complete
adegeo Sep 26, 2025
c5dca0f
Add xref links
adegeo Sep 29, 2025
2ee9866
Copy code snippets to local folder
adegeo Sep 29, 2025
6dd1c94
Add instruction files
adegeo Sep 30, 2025
d4a278a
Update how-to-add-data
adegeo Oct 2, 2025
ada3e3c
Phase 2.2 Completed
adegeo Oct 2, 2025
2bdcadc
Update instructions
adegeo Oct 2, 2025
7440762
Phase 2.3: Brief edit pass
adegeo Oct 2, 2025
9b7c0bb
Phase 2.3: Migrate snippets
adegeo Oct 2, 2025
6ee3a2c
More copilot updates
adegeo Oct 2, 2025
f15d8d2
Phase 2.3: Final commit before build
adegeo Oct 2, 2025
976713e
Fix snippet ids
adegeo Oct 2, 2025
9829a2c
More instruction updates
adegeo Oct 3, 2025
d920b4b
Phase 1: Convert code to snippets
adegeo Oct 3, 2025
076b6d7
Update instructions
adegeo Oct 3, 2025
3fd65b9
Phase 3.3: Complete
adegeo Oct 3, 2025
5ec04de
Fix code and move around
adegeo Oct 3, 2025
50c698f
Fix the projects and ref
adegeo Oct 3, 2025
0850297
Remove temp project files
adegeo Oct 3, 2025
a154219
Update the RefreshLink prompt
adegeo Oct 3, 2025
a31e7ce
Fix link
adegeo Oct 3, 2025
dc2c4bf
Fix project file
adegeo Oct 3, 2025
012ea55
Update instructions again
adegeo Oct 8, 2025
56f9208
Update snippets per feedback
adegeo Oct 8, 2025
fedabbd
Remove the ITypedDataObject snippet as it didn't teach anything
adegeo Oct 8, 2025
f4e6bca
Add missing instruction
adegeo Oct 8, 2025
137980b
Inlined all the silly method writelines copilot generated
adegeo Oct 8, 2025
f5ce268
More prompt updates
adegeo Oct 9, 2025
9aa90f1
Pre-upgrade commit: Save current changes before .NET 10 upgrade
adegeo Oct 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 59 additions & 4 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@

## Disclosure

IMPORTANT: 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:
IMPORTANT: For any Markdown files generated by AI, always disclose that they were created with the assistance of AI. Add the `ai-usage` frontmatter key/value pair:

```markdown
ai-usage: ai-generated
```
- When Copilot generates the article through GitHub without the use of a human:

```markdown
ai-usage: ai-generated
```

- When using an IDE with a human guiding AI:

```markdown
ai-usage: ai-assisted
```

## New articles

- New articles must follow a template in the /.github/projects/article-templates/ folder.
- If you don't know which template to use, ask.

## Terminology

Expand All @@ -28,6 +41,7 @@ Follow [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-g

### Structure and Format

- Markdown elements should have blank lines around them. Don't add extra blank lines if they already exist.
- Sentence case headings (no gerunds in titles).
- Be concise, break up long sentences.
- IMPORTANT: Oxford comma in lists.
Expand Down Expand Up @@ -66,6 +80,47 @@ For snippets >6 lines:
1. Create examples in both C# and Visual Basic unless the article referencing the snippet resides in the in the `csharp`, `fsharp`, and `visual-basic` language folders.
1. When you add code, use code comments sparingly because they don't get localized. You can use them to briefly clarify code-specific details (such as logic, parameters, or edge cases). Put any critical information and context in the markdown text of the referencing article.

## .NET Framework vs .NET differences

When documenting differences between .NET Framework and .NET (like .NET 6 and newer), choose the appropriate system:

### Use Tabs
Use tabbed content when the differences are code-based:

```markdown
# [.NET](#tab/dotnet)

<how it works in .NET>

# [.NET Framework](#tab/dotnetframework)

<how it works in .NET Framework>

---
```

### Use Pivots
Use zone pivots when there are conceptual differences that can't easily be explained with tabs and a note. Pivots allow for more comprehensive explanations of different approaches or methodologies.

To use zone pivots:

1. Add `zone_pivot_groups: dotnet-version` to the article's frontmatter
2. Use zone pivot syntax in content:

```markdown
::: zone pivot="dotnet"

Your .NET content here

::: zone-end

::: zone pivot="dotnetframework"

Your .NET Framework content here

::: zone-end
```

## File Naming

New Markdown files: lowercase with hyphens, omit filler words (the, a, etc.).
Expand Down
142 changes: 142 additions & 0 deletions .github/instructions/Snippets.Migrate.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
---
description: Migrate code from the old ~/samples/snippets/ location to the relative ./snippets location.
---

# Migrate code snippets

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

## Repository structure for code snippets

**IMPORTANT**: This repository has TWO different locations for code snippets:

### Old location (legacy - to be migrated FROM)
- Path: `~/samples/snippets/`
- Example: `~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/CS/form1.cs`
- Status: Legacy, should be migrated to new location

### New location (current standard - migrate TO)
- Path pattern: `./snippets/{doc-file}/[net-or-framework]/{code-language}/`
- Example: `./snippets/how-to-add-data-to-the-clipboard/net/csharp/form1.cs`

**Path components explained:**
- `{doc-file}`: The markdown article filename WITHOUT the `.md` extension
- Example: For article `how-to-add-data-to-the-clipboard.md` → use `how-to-add-data-to-the-clipboard`
- `[net-or-framework]`: Choose based on target framework:
- `net`: For .NET (.NET 6 and newer)
- `framework`: For .NET Framework (4.8 and older)
- **Rule**: Only include this subfolder when the article demonstrates BOTH .NET and .NET Framework approaches
- `{code-language}`:
- `csharp`: For C# code
- `vb`: For Visual Basic code

## Legacy code characteristics (migrate FROM these)

**Location**: `~/samples/snippets/` folder
**Problems with legacy code:**
- Written for .NET Framework (outdated)
- Often incomplete or non-compilable
- May lack project files
- Uses outdated syntax and patterns

**Legacy article references look like this:**
```markdown
[!code-{code-language}[description](~/samples/snippets/{path-to-file}#{snippet-identifier})]
```

## Current code requirements (migrate TO these)

**Location**: `./snippets/{doc-file}/[framework]/{code-language}/`

**Requirements for current code standards:**
- ✅ MUST be complete and compilable
- ✅ MUST include a project file
- ✅ MUST target appropriate .NET version (see targeting rules below)
- ✅ MUST provide BOTH C# and Visual Basic versions
- ✅ MUST use appropriate syntax for the target framework
- ✅ MUST use meaningful, descriptive snippet identifiers in CamelCase format
- **Examples** of good snippet identifiers: `BasicClipboardData`, `CustomDataFormat`, `ClipboardImageHandling`
- **Avoid** simplistic identifiers like `1`, `2`, `code1`, or `snippet1`

**Current article references look like this:**
```markdown
:::code language="{code-language}" source="{file-path}" id="{snippet-identifier}":::
```

**Framework targeting rules:**
- **Migration vs. Modernization**:
- **Migration**: Move code to new location with minimal changes
- **Modernization**: Update code to use latest .NET features and best practices
- **When to migrate only**: When article has `ms.service: dotnet-framework` frontmatter or is specifically about .NET Framework features
- **When to modernize**: When article demonstrates both .NET and .NET Framework, or when specifically requested
- **Default targeting**:
- For .NET Framework-specific articles: Keep targeting .NET Framework
- For general articles: Target latest .NET version (e.g., .NET 10)
- For mixed articles: Create separate snippets in `net/` and `framework/` subfolders

## Migration steps (follow in order)

**WHEN TO MIGRATE**: Migrate code when you encounter articles with references to `~/samples/snippets/` paths.

**STEP-BY-STEP PROCESS:**

### 1. Analyze existing code and article context
- **Find**: Locate the legacy snippet file in `~/samples/snippets/`
- **Check frontmatter**: Look for `ms.service: dotnet-framework` in the article's frontmatter
- **Determine scope**:
- If frontmatter has `ms.service: dotnet-framework` → this is likely a .NET Framework-specific article
- if frontmatter has `ms.service: dotnet-desktop` or similar → this is likely a dual-framework or general article
- If article demonstrates both .NET and .NET Framework → prepare for dual targeting
- If article is general purpose → consider targeting current .NET
- **Identify**: Determine the programming language (C# or Visual Basic)
- **Extract**: Note the snippet identifier used in the article reference

### 2. Create new folder structure
- **Pattern**: `./snippets/{doc-file}/[net-or-framework]/{code-language}/`
- **Example**: For article `clipboard-operations.md` → create `./snippets/clipboard-operations/net/csharp/`
- **Decision tree for framework folder**:
- Article has `ms.service: dotnet-framework` frontmatter → use `./snippets/{doc-file}/framework/{code-language}/`
- Article shows ONLY current .NET examples → use `./snippets/{doc-file}/{code-language}/` (omit framework folder)
- Article shows BOTH .NET and .NET Framework → create both `./snippets/{doc-file}/net/{code-language}/` and `./snippets/{doc-file}/framework/{code-language}/`

### 3. Migrate and update code
- **Copy**: Move the code file to the new location
- **Update approach**:
- **For .NET Framework articles**: Migrate with minimal changes, keep .NET Framework targeting
- **For dual-framework articles**: Create both versions with appropriate targeting and update frontmatter to `ms.service: dotnet-desktop`
- **For general articles**: Update to target current .NET only if specifically requested or if article demonstrates modernization
- **Complete**: Ensure code is fully functional and compilable
- **Project file**: Create or update project file with appropriate target framework

### 4. Create both language versions
- **Requirement**: MUST provide both C# and Visual Basic versions
- **C# path**: `./snippets/{doc-file}/[framework]/csharp/`
- **VB path**: `./snippets/{doc-file}/[framework]/vb/`

### 5. Update article references
- **Replace**: Change from legacy `[!code-...]` format to modern `:::code...:::` format
- **Before**: `[!code-csharp[description](~/samples/snippets/path/file.cs#snippet1)]`
- **After**: `:::code language="csharp" source="./snippets/doc-name/net/csharp/file.cs" id="BasicClipboardData":::`
- **Note**: Use meaningful CamelCase identifiers instead of simple numbers

### 6. Validate
- **Build**: Ensure all code compiles successfully
- **Test**: Verify snippet references work in the article
- **Clean**: Remove unused legacy files (if no other articles reference them)

### 7. Delete
- **Identify**:
- Check if the old snippet file is used by any other articles
- Some articles may use a relative path to the `samples` folder, so simply search for `samples/snippets/...`
- Be confident that all legacy snippets use a `samples/snippets` folder structure
- **Delete**: If old snippet is no longer used by any article, delete it.

## Common mistakes to avoid

- ❌ **Don't** assume all code needs to be modernized - check article context first
- ❌ **Don't** modernize .NET Framework-specific articles unless specifically requested
- ❌ **Don't** ignore the `ms.service: dotnet-framework` frontmatter indicator
- ❌ **Don't** forget to create both C# and VB versions
- ❌ **Don't** mix up the framework targeting (net vs framework)
- ❌ **Don't** forget to update ALL article references to the migrated code
- ❌ **Don't** leave incomplete or non-compilable code
121 changes: 121 additions & 0 deletions .github/instructions/Snippets.Push.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
description: Push inline code block snippets out of articles into standalone files with proper project structure.
---

# Push inline code snippets to files

**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 that might benefit from the same snippet extraction.

## Quick Reference

**WHEN TO PUSH:** Code >6 lines, complete/compilable examples, or when specifically requested
**FOLDER PATTERN:** `./snippets/{doc-file}/[net-or-framework]/{csharp|vb}/`
**PROJECT CREATION:** Always use `dotnet new {winforms|wpf|console|classlib}` commands
**LANGUAGES:** Create both C# and VB versions
**SNIPPET IDs:** Use CamelCase region markers like `<ButtonClick>`
**ARTICLE REFS:** Replace with `:::code language="csharp" source="./path" id="SnippetId":::`

## When to push snippets out of articles

**PUSH SNIPPETS WHEN:**
- Code blocks are longer than 6 lines or the rest of the article is using them
- Code demonstrates complete, compilable examples
- Code should not be reused across multiple articles
- Code represents a complete application or significant functionality
- User specifically requests snippet extraction

**KEEP INLINE WHEN:**
- Code blocks are 6 lines or shorter
- Code shows configuration snippets (XAML, JSON, XML)
- Code demonstrates simple one-liner examples
- Code is pseudo-code or conceptual examples

## Target folder structure

**IMPORTANT**: Follow the same structure as the migration guidelines:

### New snippet location (standard)
- Path pattern: `./snippets/{doc-file}/[net-or-framework]/{code-language}/`
- Example: `./snippets/create-windows-forms-app/net/csharp/`

**Path components explained:**
- `{doc-file}`: The markdown article filename WITHOUT the `.md` extension
- Example: For article `create-windows-forms-app.md` → use `create-windows-forms-app`
- `[net-or-framework]`: Choose based on target framework:
- `net`: For .NET (.NET 6 and newer)
- `framework`: For .NET Framework (4.8 and older)
- **Rule**: Only include this subfolder when the article demonstrates BOTH .NET and .NET Framework approaches
- `{code-language}`:
- `csharp`: For C# code
- `vb`: For Visual Basic code

## Framework targeting and project types

**Determine target framework:**
- Check article frontmatter `ms.service` value:
- `dotnet-framework` → .NET Framework 4.8
- `dotnet-desktop` → Current .NET (e.g., .NET 10)
- Examine code patterns and article content

**Create appropriate project with `dotnet new`:**

| Project Type | Indicators | .NET Command | .NET Framework Command |
|--------------|------------|--------------|------------------------|
| **Windows Forms** | `System.Windows.Forms`, `Form`, `/winforms/` path | `dotnet new winforms` | `dotnet new winforms --framework net48` |
| **WPF** | `System.Windows`, `Window`, XAML, `/wpf/` path | `dotnet new wpf` | `dotnet new wpf --framework net48` |
| **Console** | `Console.WriteLine`, simple examples, no UI | `dotnet new console` | `dotnet new console --framework net48` |
| **Class Library** | Reusable components, no entry point | `dotnet new classlib` | `dotnet new classlib --framework net48` |

## Push process

### 1. Analyze and prepare
- Locate code blocks >6 lines or complete examples
- Determine project type from code patterns and article location
- Check framework targeting from frontmatter
- Create folder structure: `./snippets/{doc-file}/[net-or-framework]/{csharp|vb}/`

### 2. Create projects and extract code
- Run appropriate `dotnet new` command in each language folder
- Copy and complete code to make it compilable
- Add missing using statements, namespaces, class declarations
- Modernize code patterns if targeting current .NET
- Test compilation with `dotnet build`

### 3. Add snippet references and update article
- Add CamelCase region markers: `// <ButtonClick>` and `// </ButtonClick>`
- Use same identifiers across C# and VB versions
- Replace inline code with snippet references:
```markdown
:::code language="csharp" source="./snippets/doc-name/net/csharp/File.cs" id="ButtonClick":::
:::code language="vb" source="./snippets/doc-name/net/vb/File.vb" id="ButtonClick":::
```
- DO NOT use language tabs, simply put them side-by-side
- Verify all paths and references are correct

### 4. Make sure frontmatter specifies a language when required

If both CSharp and VB examples are provided make sure the following frontmatter is at the top of the article:

```yml
dev_langs:
- "csharp"
- "vb"
```

## Common mistakes to avoid

- ❌ Extracting short snippets (≤6 lines) without request
- ❌ Skipping `dotnet new` commands or creating incomplete projects
- ❌ Missing C# or VB versions
- ❌ Using language tabs
- ❌ Wrong project type (winforms vs wpf vs console)
- ❌ Incorrect framework targeting (net vs framework)
- ❌ Missing or inconsistent snippet region identifiers
- ❌ Code that doesn't compile

## Quality checklist

- ✅ Correct folder structure and project type
- ✅ Both C# and VB versions compile successfully
- ✅ Snippet regions use CamelCase identifiers
- ✅ Article uses correct `:::code...:::` syntax with valid paths
Loading