Develop C# and .NET based applications. Includes all needed SDKs, extensions, and dependencies.
| Options Id | Description | Type | Default Value |
|---|---|---|---|
| imageVariant | .NET version: | string | 10.0-noble |
This template references an image that was pre-built to automatically include needed devcontainer.json metadata.
- Image: mcr.microsoft.com/devcontainers/dotnet (source)
- Applies devcontainer.json contents from image: Yes (source)
To enable HTTPS in ASP.NET, you can export a copy of your local dev certificate.
-
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"
-
Add the following in to
.devcontainer/devcontainer.json:"remoteEnv": { "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere", "ASPNETCORE_Kestrel__Certificates__Default__Path": "${containerEnv:HOME}/.aspnet/https/aspnetapp.pfx", }, "portsAttributes": { "5001": { "protocol": "https" } }
...where
5001is the HTTPS port. -
Finally, make the certificate available in the container as follows:
- Start the Dev Container
- Copy
.aspnet/https/aspnetapp.pfxfrom your local home (/home/yournamehere) or user profile (C:\Users\yournamehere) folder into your Dev Container. For example, you can drag the file into the root of the File Explorer when using VS Code. - Move the file to the correct place in the container. For example, in VS Code start a terminal and run:
mkdir -p $HOME/.aspnet/https && mv aspnetapp.pfx $HOME/.aspnet/https
Note: This file was auto-generated from the devcontainer-template.json. Add additional notes to a NOTES.md.