|
| 1 | +# Coding Agent Instructions for dotnet-framework-docker |
| 2 | + |
| 3 | +This repository contains the official Docker images for .NET Framework, published to Microsoft Container Registry (mcr.microsoft.com). |
| 4 | + |
| 5 | +## Build and Test Commands |
| 6 | + |
| 7 | +```powershell |
| 8 | +# Build and test all images for a specific .NET version |
| 9 | +./build-and-test.ps1 -Version 4.8 |
| 10 | +
|
| 11 | +# Build only (no tests) for specific version and OS |
| 12 | +./build-and-test.ps1 -Version 4.8 -OS windowsservercore-ltsc2019 -Mode Build |
| 13 | +
|
| 14 | +# Test only |
| 15 | +./build-and-test.ps1 -Version 4.8 -Mode Test |
| 16 | +
|
| 17 | +# Build/test specific image variants: runtime, sdk, aspnet, wcf |
| 18 | +./build-and-test.ps1 -Repos sdk -Version 4.8.1 |
| 19 | +
|
| 20 | +# Run a single test by filter |
| 21 | +./tests/run-tests.ps1 -TestCategories sdk |
| 22 | +dotnet test tests/Microsoft.DotNet.Framework.Docker.Tests --filter "Category=sdk" |
| 23 | +``` |
| 24 | + |
| 25 | +## Architecture |
| 26 | + |
| 27 | +### Image Hierarchy |
| 28 | + |
| 29 | +Images build on each other: `runtime` → `aspnet` → `wcf`, with `sdk` building on `runtime`. Each variant supports multiple .NET Framework versions (4.8, 4.8.1) across Windows Server Core versions (ltsc2016, ltsc2019, ltsc2022, ltsc2025). |
| 30 | + |
| 31 | +### Generated Files (Do Not Edit Directly) |
| 32 | + |
| 33 | +- **Dockerfiles in `src/`**: Generated from [Cottle templates](https://cottle.readthedocs.io/en/stable/) in `eng/dockerfile-templates/` |
| 34 | +- **README files**: Generated from templates in `eng/readme-templates/` |
| 35 | + |
| 36 | +To modify Dockerfiles or READMEs, edit the templates and regenerate: |
| 37 | + |
| 38 | +```powershell |
| 39 | +# Regenerate Dockerfiles |
| 40 | +./eng/dockerfile-templates/Get-GeneratedDockerfiles.ps1 |
| 41 | +
|
| 42 | +# Regenerate READMEs |
| 43 | +./eng/readme-templates/Get-GeneratedReadmes.ps1 |
| 44 | +
|
| 45 | +# Validate without regenerating |
| 46 | +./eng/dockerfile-templates/Get-GeneratedDockerfiles.ps1 -Validate |
| 47 | +``` |
| 48 | + |
| 49 | +### Key Configuration Files |
| 50 | + |
| 51 | +- `manifest.json`: Defines all images, tags, and build configuration for the infrastructure |
| 52 | +- `manifest.versions.json`: Product versions (NuGet, Visual Studio, patches) referenced by Dockerfile templates |
| 53 | +- `manifest.datestamps.json`: Date-based tags for image versioning |
| 54 | + |
| 55 | +## Conventions |
| 56 | + |
| 57 | +### Dockerfile Template Variables |
| 58 | + |
| 59 | +Templates use Cottle syntax with variables from `manifest.versions.json`: |
| 60 | + |
| 61 | +- `VARIABLES[cat("kb|", OS_VERSION_NUMBER, "|", PRODUCT_VERSION)]` - Windows KB patches |
| 62 | +- `VARIABLES[cat(PRODUCT_VERSION, "|url")]` - .NET Framework installer URLs |
| 63 | +- `OS_VERSION_NUMBER`, `PRODUCT_VERSION` - Context variables for the build |
| 64 | + |
| 65 | +### Test Categories |
| 66 | + |
| 67 | +Tests are categorized by image type: `runtime`, `sdk`, `aspnet`, `wcf`, `pre-build`. Tests validate both static image state (environment variables) and runtime scenarios. |
| 68 | + |
| 69 | +### Updating Product Versions |
| 70 | + |
| 71 | +Update `manifest.versions.json` then regenerate Dockerfiles. This is typically done by automation. |
0 commit comments