Home / Market / containerize aspnet framework

containerize aspnet framework

Containerize an ASP.NET .NET Framework project by creating Dockerfile and .dockerfile files customized for the project.

skill★ 417948664 dlskills.shMITInstall in CosmosUpstream Source

Documentation & Preview

--- name: containerize-aspnet-framework description: 'Containerize an ASP.NET .NET Framework project by creating Dockerfile and .dockerfile files customized for the project.'

---

ASP.NET .NET Framework Containerization Prompt

Containerize the ASP.NET (.NET Framework) project specified in the containerization settings below, focusing exclusively on changes required for the application to run in a Windows Docker container. Containerization should consider all settings specified here.

REMEMBER: This is a .NET Framework application, not .NET Core. The containerization process will be different from that of a .NET Core application.

Containerization Settings

This section of the prompt contains the specific settings and configurations required for containerizing the ASP.NET (.NET Framework) application. Prior to running this prompt, ensure that the settings are filled out with the necessary information. Note that in many cases, only the first few settings are required. Later settings can be left as defaults if they do not apply to the project being containerized.

Any settings that are not specified will be set to default values. The default values are provided in [square brackets].

Basic Project Information

  1. Project to containerize:
  1. Windows Server SKU to use:
  1. Windows Server version to use:
  1. Custom base image for the build stage of the Docker image ("None" to use standard Microsoft base image):
  1. Custom base image for the run stage of the Docker image ("None" to use standard Microsoft base image):

Container Configuration

  1. Ports that must be exposed in the container image:
  1. User account the container should run as:
  1. IIS settings that must be configured in the container image:

Build configuration

  1. Custom build steps that must be performed before building the container image:
  1. Custom build steps that must be performed after building the container image:

Dependencies

  1. .NET assemblies that should be registered in the GAC in the container image:
  1. MSIs that must be copied to the container image and installed:
  1. COM components that must be registered in the container image:

System Configuration

  1. Registry keys and values that must be added to the container image:
  1. Environment variables that must be set in the container image:
  1. Windows Server roles and features that must be installed in the container image:

File System

  1. Files/directories that need to be copied to the container image:
  1. Files/directories to exclude from containerization:

.dockerignore Configuration

  1. Patterns to include in the .dockerignore file (.dockerignore will already have common defaults; these are additional patterns):

Health Check Configuration

  1. Health check endpoint:
  1. Health check interval and timeout:

Additional Instructions

  1. Other instructions that must be followed to containerize the project:
  1. Known issues to address:

Scope

Execution Process

  1. Review the containerization settings above to understand the containerization requirements
  2. Create a progress.md file to track changes with check marks
  3. Determine the .NET Framework version from the project's .csproj file by checking the TargetFrameworkVersion element
  4. Select the appropriate Windows Server container image based on:
  1. Ensure that required NuGet packages are installed. DO NOT install these if they are missing. If they are not installed, the user must install them manually. If they are not installed, pause executing this prompt and ask the user to install them using the Visual Studio NuGet Package Manager or Visual Studio package manager console. The following packages are required:
  1. Modify the web.config file to add configuration builders section and settings to read app settings and connection strings from environment variables:
     <configSections>
       <section name="configBuilders" type="System.Configuration.ConfigurationBuildersSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false" />
     </configSections>
     <configBuilders>
       <builders>
         <add name="Environment" type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment" />
       </builders>
     </configBuilders>
     <appSettings configBuilders="Environment">
       <!-- existing app settings -->
     </appSettings>
     <connectionStrings configBuilders="Environment">
       <!-- existing connection strings -->
     </connectionStrings>
  1. Create a LogMonitorConfig.json file in the folder where the Dockerfile will be created by copying the reference LogMonitorConfig.json file at the end of this prompt. The file's contents MUST NOT not be modified and should match the reference content exactly unless instructions in containerization settings specify otherwise.
  1. Create a Dockerfile in the root of the project directory to containerize the application
  1. Create a .dockerignore file in the root of the project directory to exclude unnecessary files from the Docker image. The .dockerignore file MUST include at least the following elements as well as additional patterns as specified in the containerization settings:
  1. Configure health checks if specified in the settings:
  1. Add the dockerfile to the project by adding the following item to the project file: <None Include="Dockerfile" />
  2. Mark tasks as completed: [ ] → [✓]
  3. Continue until all tasks are complete and Docker build succeeds

Build and Runtime Verification

confirm that Docker build succeeds once the Dockerfile is completed. Use the following command to build the Docker image:

docker build -t aspnet-app:latest .

If the build fails, review the error messages and make necessary adjustments to the Dockerfile or project configuration. Report success/failure.

Progress Tracking

Maintain a progress.md file with the following structure:

# Containerization Progress

## Environment Detection
- [ ] .NET Framework version detection (version: ___)
- [ ] Windows Server SKU selection (SKU: ___)
- [ ] Windows Server version selection (Version: ___)

## Configuration Changes
- [ ] Web.config modifications for configuration builders
- [ ] NuGet package source configuration (if applicable)
- [ ] Copy LogMonitorConfig.json and adjust if required by settings

## Containerization
- [ ] Dockerfile creation
- [ ] .dockerignore file creation
- [ ] Build stage created with SDK image
- [ ] sln, csproj, packages.config, and (if applicable) NuGet.config copied for package restore
- [ ] Runti