Sign inSign up

.NET Development Container Images

Verified Publisher

devcontainers/dotnet

By Microsoft

Updated about 2 years ago

A dev container spec-supported image for working with .NET.

6

microsoft/devcontainers-dotnet repository overview

C# (.NET)

About

Develop C# and .NET based applications. Includes all needed SDKs, extensions, and dependencies.

MetadataValue
CategoriesCore, Languages
Image typeDockerfile
Published imagesmcr.microsoft.com/devcontainers/dotnet
Available image variants9.0 /9.0-bookworm, 9.0-noble, 8.0-noble, 8.0-jammy (full list)
Published image architecture(s)x86-64, arm64/aarch64 for bookworm, bullseye, jammy variants
Container host OS supportLinux, macOS, Windows
Container OSUbuntu (-focal, -jammy), Debian (-bullseye, -bookworm)
Languages, platforms.NET, .NET Core, C#

See history for information on the contents of published images.

Using this image

You can directly reference pre-built versions of Dockerfile by using the image property in .devcontainer/devcontainer.json or updating the FROM statement in your own Dockerfile to one of the following. An example Dockerfile is included in this repository.

  • mcr.microsoft.com/devcontainers/dotnet (latest)
  • mcr.microsoft.com/devcontainers/dotnet:9.0 (or 9.0-bookworm, 9.0-noble to pin to an OS version)
  • mcr.microsoft.com/devcontainers/dotnet:8.0 (or 8.0-bookworm, 8.0-noble, 8.0-focal to pin to an OS version)

Refer to this guide for more details.

You can decide how often you want updates by referencing a semantic version of each image. For example:

  • mcr.microsoft.com/devcontainers/dotnet:1-9.0
  • mcr.microsoft.com/devcontainers/dotnet:1.3-9.0
  • mcr.microsoft.com/devcontainers/dotnet:1.3.0-9.0

See history for information on the contents of each version and here for a complete list of available tags.

Alternatively, you can use the contents of .devcontainer to fully customize your container's contents or to build it for a container host architecture not supported by the image.

Enabling HTTPS in ASP.NET using your own dev certificate

To enable HTTPS in ASP.NET, you can mount an exported copy of your local dev certificate.

  1. Export it using the following command:

    Windows PowerShell

    dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
    

    macOS/Linux terminal

    dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
    
  2. Add the following in to devcontainer.json:

    "remoteEnv": {
        "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
        "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
    }
    
  3. Finally, make the certificate available in the container as follows:

    Add the following to devcontainer.json:

    "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ]
    
Installing Node.js or the Azure CLI

Given JavaScript front-end web client code written for use in conjunction with an ASP.NET back-end often requires the use of Node.js-based utilities to build, this container also includes nvm so that you can easily install Node.js.

If you would like to install the Azure CLI, you can reference a dev container feature by adding the following to devcontainer.json:

{
  "features": {
    "ghcr.io/devcontainers/features/azure-cli:1": {
      "version": "latest"
    }
  }
}

Support

The dev container spec images are maintained in the devcontainers/images repo. You can explore each image and open issues or feature requests.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License. See LICENSE.

Tag Summary

No tags have been pushed to this repository yet.