mcpbeat

Managing Winforms Designer Code

microsoft/managing-winforms-designer-code

> Governs WinForms Designer-generated code structure and InitializeComponent patterns. Use when writing or reviewing .Designer.cs files, fixing "Designer file cannot be loaded" errors, resolving Designer round-trip issues, validating control instantiation in InitializeComponent, implementing proper Dispose(bool disposing) pattern with components.Dispose(), working with IContainer and components field, troubleshooting Designer serialization failures, organizing Designer code vs application logic separation, or understanding what code belongs in InitializeComponent vs elsewhere. Also triggers for "InitializeComponent", ".Designer.cs file", "Designer cannot load", "components.Dispose", "IContainer field", "Designer compatibility", "Designer round-trip", and "Form Designer errors".

6k tokens
context cost
the whole folder, loaded on every use
2
files
instructions only
0
copies elsewhere
how many repositories repackaged it
17
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/microsoft/upgrade-agent-plugins --skill managing-winforms-designer-code

What comes with it

20 126 bytes besides the instruction
ref/detailed-guide.md

The instruction itself

5 sections, as written by the author

WinForms Designer Code Rules

The WinForms Designer generates serialization code, not regular C# code. Understanding and following these rules is CRITICAL for Designer compatibility. All WinForms Forms and UserControls should be Designer-compatible — these rules are not optional guidance but mandatory constraints for any code that the Designer must be able to round-trip (read, modify, and re-serialize).

When to Use This Skill

Use this skill when:

  • Generating the code which makes up a Form or a UserControl in WinForms.
  • Writing or modifying .Designer.cs or .Designer.vb files
  • Creating user controls that need Designer support
  • Reviewing Designer-generated code
  • Reviewing whether WinForms Forms/UserControls are "designed according to standard", "not designed properly", or similar; pair this with managing-winforms-high-dpi-layout so both Designer serialization and human/layout/DPI quality are checked.
  • Debugging Designer-related issues
  • Migrating forms between .NET Framework and .NET
  • Migrating VB6 Code to either Visual Basic (.NET) or C# WinForms Projects.

IMPORTANT: Other skills (layout, rendering, data binding, MVVM) describe *what* to build. This skill defines *how* the Designer code-behind file must be structured. When those skills show control configuration, the actual property assignments belong in InitializeComponent following the rules below.

  • building-winforms-applications
  • managing-winforms-data-binding
  • managing-winforms-mvvm
  • managing-winforms-high-dpi-layout
  • creating-winforms-custom-controls

Detailed Guidance

Read Detailed guide for comprehensive patterns, examples, and troubleshooting.

Workflow

  • Confirm the scenario matches the triggers in this skill.
  • Apply the baseline pattern from this file.
  • Read Detailed guide for advanced or edge-case handling.
  • Validate changes with an actual build and runtime check.

How to use it

Copy the folder

Take microsoft/managing-winforms-designer-code from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.