# Contributing

See [dotnet/runtime Contributing](https://github.com/dotnet/runtime/blob/master/CONTRIBUTING.md) for information about coding styles, source structure, making pull requests, and more.

## Workflow Instructions

### Building

The [`build-and-test.ps1`](https://github.com/microsoft/dotnet-framework-docker/blob/main/build-and-test.ps1) script will build and test the .NET Framework Docker images. Given the matrix of supported .NET and Windows versions there are numerous Dockerfiles and building can take a while. To make this manageable, the script supports several options for filtering down what images get built and tested.

- Build and test all of the .NET FX 4.8 images.

    ``` console
    > ./build-and-test.ps1 -Version 4.8
    ```

- Build the .NET FX 4.8 windowsservercore-ltsc2019 images

    ``` console
    > ./build-and-test.ps1 -Version 4.8 -OS windowsservercore-ltsc2019 -Mode Build
    ```

### Editing Dockerfiles

The [Dockerfiles](https://github.com/search?q=repo%3Amicrosoft%2Fdotnet-framework-docker+path%3Asrc%2F**%2FDockerfile&type=code) contained in this repo are generated from a set of [Cottle](https://cottle.readthedocs.io/en/stable/page/01-overview.html) based [templates](https://github.com/microsoft/dotnet-framework-docker/tree/main/eng/dockerfile-templates). A single template generates the set of Dockerfiles that are similar (e.g. all wcf Dockerfiles).  This ensures consistency across the various Dockerfiles and eases the burden of making changes to the Dockerfiles.  Instead of editing the Dockerfiles directly, the templates should be updated and then the Dockerfiles should get regenerated by running the [generate Dockerfiles script](https://github.com/microsoft/dotnet-framework-docker/blob/main/eng/dockerfile-templates/Get-GeneratedDockerfiles.ps1).

### Editing READMEs

The [READMEs](https://github.com/search?q=repo%3Amicrosoft%2Fdotnet-framework-docker+path%3A**%2FREADME*+-path%3Aeng+-path%3Asamples&type=code&ref=advsearch) contained in this repo are used as the descriptions for the Docker repositories the images are published to.  Just like the Dockerfiles, the READMEs are generated from a set of [Cottle](https://cottle.readthedocs.io/en/stable/page/01-overview.html) based [templates](https://github.com/microsoft/dotnet-framework-docker/tree/main/eng/readme-templates).  This ensures consistency across the various READMEs and eases the burden of making changes.  Instead of editing the READMEs directly, the templates should be updated and then the READMEs should get regenerated by running the [generate READMEs script](https://github.com/microsoft/dotnet-framework-docker/blob/main/eng/readme-templates/Get-GeneratedReadmes.ps1).

### Tests

There are two basic types of [tests](https://github.com/microsoft/dotnet-framework-docker/tree/main/tests) for each of the images produced from this repo.

1. Unit tests that validate the static state of images.  This includes things like verifing which environment variables are defined.
1. Scenario tests that validate basic usage scenarios.  For example the SDK image is used to create, build and run a new console app.

When editing Dockerfiles, please ensure the appropriate test changes are also made.

### Metadata Changes

The [`manifest.json`](https://github.com/microsoft/dotnet-framework-docker/blob/main/manifest.json) contains metadata used by the engineering infrastructure to build and publish the images.  It includes information such as:

- Dockerfiles to build
- Image Tags
- Manifest/shared tags to create and which images they reference
- Docker repositories to publish the images to
- Dockerfile templates used to generate the Dockerfiles
- etc.

When adding or removing Dockerfiles, it is important to update the `manifest.json` accordingly.

### Updating Product Versions

Updating the product versions (e.g. NuGet, Visual Studio, etc.) contained within the images is typically performed by automation. All of the product version information is stored in the [`manifest.versions.json`](https://github.com/microsoft/dotnet-framework-docker/blob/main/manifest.versions.json) file. The Dockerfile templates reference the product versions numbers and download urls from this file. Updating a product version involves updating the `manifest.versions.json` and regenerating the Dockerfiles via running the [generate Dockerfiles script](https://github.com/microsoft/dotnet-framework-docker/blob/main/eng/dockerfile-templates/Get-GeneratedDockerfiles.ps1).
