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 :)

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up