|
| 1 | +--- |
| 2 | +name: webforms-runner |
| 3 | +description: "**WORKFLOW SKILL** - Starts ASP.NET Web Forms applications using IIS Express and captures screenshots with Playwright. USE FOR: running WebForms samples, capturing 'before' screenshots for migration documentation, testing original Web Forms applications. DO NOT USE FOR: running Blazor apps (use dotnet run), running .NET Core apps (use dotnet CLI). INVOKES: IIS Express CLI, Playwright MCP browser tools." |
| 4 | +--- |
| 5 | + |
| 6 | +# WebForms Runner Skill |
| 7 | + |
| 8 | +This skill enables running ASP.NET Web Forms applications using IIS Express and capturing screenshots with Playwright for documentation purposes. |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +- **IIS Express** installed (typically at `C:\Program Files (x86)\IIS Express\iisexpress.exe`) |
| 13 | +- **Visual Studio Build Tools** or **Visual Studio** (for MSBuild) |
| 14 | +- **.NET Framework 4.x** installed |
| 15 | +- **Playwright MCP tools** available (browser_navigate, browser_snapshot, browser_take_screenshot) |
| 16 | + |
| 17 | +## Available Web Forms Samples |
| 18 | + |
| 19 | +This repository contains two Web Forms sample applications: |
| 20 | + |
| 21 | +| Sample | Path | Port | Database | |
| 22 | +|--------|------|------|----------| |
| 23 | +| **ContosoUniversity** | `samples/ContosoUniversity/ContosoUniversity/` | 52477 | SQL Server LocalDB | |
| 24 | +| **WingtipToys** | `samples/WingtipToys/WingtipToys/` | 44300 | SQL Server LocalDB | |
| 25 | + |
| 26 | +## Starting a Web Forms Application |
| 27 | + |
| 28 | +### Step 1: Build the Project |
| 29 | + |
| 30 | +Web Forms projects require MSBuild (not `dotnet build`): |
| 31 | + |
| 32 | +```powershell |
| 33 | +# ContosoUniversity |
| 34 | +msbuild "samples\ContosoUniversity\ContosoUniversity\ContosoUniversity.csproj" /p:Configuration=Debug /t:Build /v:m |
| 35 | +
|
| 36 | +# WingtipToys |
| 37 | +msbuild "samples\WingtipToys\WingtipToys\WingtipToys.csproj" /p:Configuration=Debug /t:Build /v:m |
| 38 | +``` |
| 39 | + |
| 40 | +If NuGet packages are missing, restore first: |
| 41 | +```powershell |
| 42 | +nuget restore "samples\ContosoUniversity\ContosoUniversity.sln" |
| 43 | +``` |
| 44 | + |
| 45 | +### Step 2: Start IIS Express |
| 46 | + |
| 47 | +Use the `/path` option to run directly from the project folder: |
| 48 | + |
| 49 | +```powershell |
| 50 | +# ContosoUniversity (port 52477) |
| 51 | +& "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:"D:\BlazorWebFormsComponents\samples\ContosoUniversity\ContosoUniversity" /port:52477 |
| 52 | +
|
| 53 | +# WingtipToys (port 44300) |
| 54 | +& "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:"D:\BlazorWebFormsComponents\samples\WingtipToys\WingtipToys" /port:44300 |
| 55 | +``` |
| 56 | + |
| 57 | +**Important:** Run IIS Express in async mode with `detach: true` since it's a server process: |
| 58 | +``` |
| 59 | +mode: "async", detach: true |
| 60 | +``` |
| 61 | + |
| 62 | +### Step 3: Verify the Site is Running |
| 63 | + |
| 64 | +Wait 3-5 seconds for startup, then check with: |
| 65 | +```powershell |
| 66 | +curl http://localhost:52477 -UseBasicParsing | Select-Object -ExpandProperty StatusCode |
| 67 | +``` |
| 68 | + |
| 69 | +## IIS Express Command Reference |
| 70 | + |
| 71 | +``` |
| 72 | +iisexpress.exe [options] |
| 73 | +
|
| 74 | +Key options: |
| 75 | + /path:app-path Physical path to the application folder |
| 76 | + /port:port-number Port to bind (default: 8080) |
| 77 | + /clr:clr-version .NET Framework version (e.g., v4.0) |
| 78 | + /systray:true|false Show system tray icon (default: true) |
| 79 | +``` |
| 80 | + |
| 81 | +## Capturing Screenshots with Playwright |
| 82 | + |
| 83 | +Use the Playwright MCP tools to capture screenshots of the running Web Forms application. |
| 84 | + |
| 85 | +### Workflow for Documentation Screenshots |
| 86 | + |
| 87 | +1. **Navigate to the page:** |
| 88 | + ``` |
| 89 | + playwright-browser_navigate: { url: "http://localhost:52477/Home.aspx" } |
| 90 | + ``` |
| 91 | + |
| 92 | +2. **Wait for page load:** |
| 93 | + ``` |
| 94 | + playwright-browser_wait_for: { time: 2 } |
| 95 | + ``` |
| 96 | + |
| 97 | +3. **Take a snapshot (for accessibility tree):** |
| 98 | + ``` |
| 99 | + playwright-browser_snapshot: {} |
| 100 | + ``` |
| 101 | + |
| 102 | +4. **Take a screenshot:** |
| 103 | + ``` |
| 104 | + playwright-browser_take_screenshot: { |
| 105 | + filename: "dev-docs/screenshots/webforms-home.png", |
| 106 | + type: "png" |
| 107 | + } |
| 108 | + ``` |
| 109 | + |
| 110 | +### ContosoUniversity Pages |
| 111 | + |
| 112 | +| Page | URL | Screenshot Name | |
| 113 | +|------|-----|-----------------| |
| 114 | +| Home | `/Home.aspx` | `contoso-webforms-home.png` | |
| 115 | +| Students | `/Students.aspx` | `contoso-webforms-students.png` | |
| 116 | +| Courses | `/Courses.aspx` | `contoso-webforms-courses.png` | |
| 117 | +| Instructors | `/Instructors.aspx` | `contoso-webforms-instructors.png` | |
| 118 | +| About | `/About.aspx` | `contoso-webforms-about.png` | |
| 119 | + |
| 120 | +### WingtipToys Pages |
| 121 | + |
| 122 | +| Page | URL | Screenshot Name | |
| 123 | +|------|-----|-----------------| |
| 124 | +| Home | `/Default.aspx` | `wingtip-webforms-home.png` | |
| 125 | +| Products | `/ProductList.aspx?ProductCategory=1` | `wingtip-webforms-products.png` | |
| 126 | +| Product Detail | `/ProductDetails.aspx?ProductID=1` | `wingtip-webforms-detail.png` | |
| 127 | +| Cart | `/ShoppingCart.aspx` | `wingtip-webforms-cart.png` | |
| 128 | + |
| 129 | +### Screenshot Best Practices |
| 130 | + |
| 131 | +1. **Use consistent naming:** `{app}-webforms-{page}.png` for before, `{app}-blazor-{page}.png` for after |
| 132 | +2. **Save to documentation folder:** `dev-docs/migration-tests/{run}-screenshots/` |
| 133 | +3. **Capture full page when needed:** Use `fullPage: true` for long pages |
| 134 | +4. **Wait for dynamic content:** Add `browser_wait_for` before screenshots if page has AJAX |
| 135 | + |
| 136 | +## Complete Example: ContosoUniversity Screenshots |
| 137 | + |
| 138 | +```powershell |
| 139 | +# 1. Build the project |
| 140 | +msbuild "samples\ContosoUniversity\ContosoUniversity\ContosoUniversity.csproj" /p:Configuration=Debug /t:Build /v:m |
| 141 | +
|
| 142 | +# 2. Start IIS Express (async, detached) |
| 143 | +# Use powershell tool with mode: "async", detach: true |
| 144 | +& "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:"D:\BlazorWebFormsComponents\samples\ContosoUniversity\ContosoUniversity" /port:52477 |
| 145 | +
|
| 146 | +# 3. Wait for startup |
| 147 | +Start-Sleep -Seconds 5 |
| 148 | +
|
| 149 | +# 4. Use Playwright MCP tools to capture screenshots: |
| 150 | +# - browser_navigate to http://localhost:52477/Home.aspx |
| 151 | +# - browser_wait_for time: 2 |
| 152 | +# - browser_take_screenshot filename: "dev-docs/contoso-screenshots/webforms-home.png" |
| 153 | +# - Repeat for each page |
| 154 | +
|
| 155 | +# 5. Stop IIS Express when done |
| 156 | +# Find the process ID from the async shell output |
| 157 | +Stop-Process -Id <PID> |
| 158 | +``` |
| 159 | + |
| 160 | +## Stopping IIS Express |
| 161 | + |
| 162 | +Since IIS Express runs as a detached process, you need to stop it by PID: |
| 163 | + |
| 164 | +```powershell |
| 165 | +# Find IIS Express processes |
| 166 | +Get-Process | Where-Object { $_.ProcessName -eq "iisexpress" } |
| 167 | +
|
| 168 | +# Stop by specific PID |
| 169 | +Stop-Process -Id <PID> |
| 170 | +
|
| 171 | +# Or stop all IIS Express instances |
| 172 | +Get-Process -Name "iisexpress" -ErrorAction SilentlyContinue | Stop-Process |
| 173 | +``` |
| 174 | + |
| 175 | +## Troubleshooting |
| 176 | + |
| 177 | +### Port Already in Use |
| 178 | +```powershell |
| 179 | +# Check what's using the port |
| 180 | +Get-NetTCPConnection -LocalPort 52477 -ErrorAction SilentlyContinue |
| 181 | +
|
| 182 | +# Kill the process |
| 183 | +Stop-Process -Id (Get-NetTCPConnection -LocalPort 52477).OwningProcess |
| 184 | +``` |
| 185 | + |
| 186 | +### Missing NuGet Packages |
| 187 | +```powershell |
| 188 | +# Restore packages for the solution |
| 189 | +nuget restore "samples\ContosoUniversity\ContosoUniversity.sln" |
| 190 | +``` |
| 191 | + |
| 192 | +### Database Connection Issues |
| 193 | +- Ensure SQL Server LocalDB is installed and running |
| 194 | +- Check connection string in `Web.config` |
| 195 | +- LocalDB instances can be started with: `sqllocaldb start MSSQLLocalDB` |
| 196 | + |
| 197 | +### MSBuild Not Found |
| 198 | +Add Visual Studio MSBuild to PATH or use full path: |
| 199 | +```powershell |
| 200 | +& "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" project.csproj |
| 201 | +``` |
| 202 | + |
| 203 | +## Side-by-Side Screenshots for Migration Documentation |
| 204 | + |
| 205 | +When creating migration documentation, capture both WebForms and Blazor screenshots: |
| 206 | + |
| 207 | +``` |
| 208 | +dev-docs/migration-tests/wingtiptoys-run15-screenshots/ |
| 209 | +├── webforms-home.png # Before (WebForms) |
| 210 | +├── blazor-home.png # After (Blazor) |
| 211 | +├── webforms-products.png |
| 212 | +├── blazor-products.png |
| 213 | +└── ... |
| 214 | +``` |
| 215 | + |
| 216 | +This allows creating visual comparisons in migration reports showing the fidelity of the conversion. |
| 217 | + |
| 218 | +## Integration with Migration Workflow |
| 219 | + |
| 220 | +1. **Before migration:** Start WebForms app, capture baseline screenshots |
| 221 | +2. **Run migration:** Execute bwfc-migrate.ps1 and bwfc-migrate-layer2.ps1 |
| 222 | +3. **After migration:** Start Blazor app (`dotnet run`), capture result screenshots |
| 223 | +4. **Document:** Create side-by-side comparison in migration report |
| 224 | + |
| 225 | +## Related Skills |
| 226 | + |
| 227 | +- **webforms-migration** - For migrating ASPX/ASCX files to Blazor |
| 228 | +- **documentation** - For writing migration reports with screenshots |
0 commit comments