DEV Community

Theodor Heiselberg
Theodor Heiselberg

Posted on

12

Developing .NET Inside a devcontainer

I really love devcontainers in VS Code! The whole concept that you can define an entire dev environment using just a json file is quite amazing.

Daily, I'm developing .NET applications using C# and sometimes F#.

Here is how you can get an environment up and running in no time - with IntelliSense working!

devcontainer.json



{
    "name": "f-sharp-playground",
    "build":{
        "dockerfile": "Dockerfile"
    },
    "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces,type=bind",
    "workspaceFolder": "/workspaces",
    "customizations": {
        "vscode": {
            "extensions": [
                "ms-dotnettools.csharp",
                "ms-dotnettools.csdevkit",
                "ms-dotnettools.dotnet-interactive-vscode",
                "jebbs.plantuml",
                "Ionide.Ionide-fsharp",
                "ms-dotnettools.vscode-dotnet-runtime"
            ]
        }
    }
}


Enter fullscreen mode Exit fullscreen mode

Dockerfile



FROM mcr.microsoft.com/dotnet/sdk:8.0

# E.g. add dotnet tools here:
# RUN dotnet tool install --global dotnet-format



Enter fullscreen mode Exit fullscreen mode

How to fix the problem with IntelliSense

If you didn't add workspaceMount and workspaceFolder you can find the course of IntelliSenses crash here:

Image description

Be patient!

Every time the container rebuilds it takes most of 30 sec to install everything.

Enjoy :)

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more