ScottHolden

WinForm Visualizer — Copilot Skill

- Only captures forms that have `.Designer.cs` files with `InitializeComponent()`

ScottHolden 2 Updated 3mo ago

Resources

8
GitHub

Install

npx skillscat add scottholden/winformdiscoverskill

Install via the SkillsCat registry.

SKILL.md

WinForm Visualizer — Copilot Skill

Capture real Visual Studio WinForms Designer screenshots and generate markdown descriptions for every form in a .NET Framework WinForms project.

When to Use

Use this skill when:

  • Migrating a .NET Framework WinForms application and you need a visual inventory of all forms
  • Documenting the UI of an existing WinForms codebase
  • Creating before/after comparisons during a modernization effort
  • Reviewing forms in a project without opening Visual Studio manually

Prerequisites

  • Windows (required — WinForms and VS are Windows-only)
  • Visual Studio 2022 or later installed (the tool drives VS via COM automation)
  • .NET 9 SDK installed (to build and run the tool)
  • The target WinForms project must be openable in Visual Studio

How to Build

cd c:\Code\WinFormMigrate
dotnet build WinFormMigrate.sln

How to Run

# Basic usage — opens solution in VS, captures all forms, generates markdown + PNGs
dotnet run --project src/WinFormVisualizer -- "C:\path\to\YourApp.sln"

# Specify output folder
dotnet run --project src/WinFormVisualizer -- "C:\path\to\YourApp.sln" --output "C:\output\folder"

# Attach to an already-running VS instance instead of launching a new one
dotnet run --project src/WinFormVisualizer -- "C:\path\to\YourApp.sln" --attach

# Keep VS open after capture completes
dotnet run --project src/WinFormVisualizer -- "C:\path\to\YourApp.sln" --keep-vs-open

# Custom timeout for VS startup (seconds)
dotnet run --project src/WinFormVisualizer -- "C:\path\to\YourApp.sln" --timeout 180

Output

The tool creates an output folder (default: WinFormVisualizer_Output next to the solution) containing:

File Description
index.md Summary of all forms with links to individual files
FormName.md Per-form markdown: properties, control hierarchy tree, controls table, non-visual components
FormName.png Designer screenshot captured from the real VS WinForms designer

Sample Test Input

A sample .NET Framework 4.8 WinForms application is included at tests/input/SampleWinFormsApp/ with three forms:

  • MainForm — complex form with menus, toolstrip, tabs, datagridview, timer
  • LoginForm — simple login dialog with textboxes and buttons
  • SettingsForm — medium form with tabbed settings, radio buttons, comboboxes

Run against the sample:

dotnet run --project src/WinFormVisualizer -- "tests\input\SampleWinFormsApp\SampleWinFormsApp.sln"

How It Works

  1. Roslyn Parsing — Parses each .Designer.cs file to extract control hierarchy, properties, and non-visual components
  2. VS COM Automation — Launches Visual Studio via devenv.exe, connects through the Running Object Table (ROT)
  3. Designer Capture — Opens each form in the VS designer, locates the designer surface via UI Automation, captures via Win32 PrintWindow
  4. Markdown Generation — Produces structured markdown for each form with the captured screenshot embedded

Limitations

  • Requires a licensed Visual Studio installation (Community, Professional, or Enterprise)
  • The first run may take longer as VS initializes the solution and restores packages
  • UI Automation tree structure may vary between VS versions; debug with --keep-vs-open if captures fail
  • Only captures forms that have .Designer.cs files with InitializeComponent()