Skip to content

Example project for devcontainer usage in Visual Studio with C++

License

Notifications You must be signed in to change notification settings

robotdad/visualstudio-devcontainer-cpp

Repository files navigation

Visual Studio C++ Try Out Development Containers

This project is derived from a VS Code focused Try Development Container repo for C++. It was changed to use a Visual Studio CMake project as the base example instead of a simpler Hello World without CMake. The instructions below are also focused on just Visual Studio as opposed to Codespaces and VS Code.

A development container is a running Docker container with a well-defined tool/runtime stack and its prerequisites. You can try out development containers with GitHub Codespaces or Visual Studio Code Remote - Containers.

Setting up the development container

Visual Studio - Dev Containers

If you already have Visual Studio 2022 17.4 Preview 2 with the Linux workload and Docker installed, you can clone the source code and open the folder in Visual Studio and get going.

Dev Containers for C++ in Visual Studio has a full write up of the experience.

  1. If this is your first time using a development container, please ensure your system meets the pre-reqs (i.e. have Docker installed) in the getting started steps.

Things to try

Once you have this sample opened, you'll be able to work with it like you would locally.

Some things to try:

  1. Edit:
    • Open main.cpp
    • Try adding some code and check out the language features.
  2. Terminal: Press ctrl+shift+` and type uname and other Linux commands from the terminal window.
  3. Build, Run, and Debug:
    • Open MyCppApp.cpp
    • Add a breakpoint (e.g. on line 10).
    • Press F5 to launch the app in the container.
    • Once the breakpoint is hit, try hovering over variables, examining locals, and more.

License

Copyright © Microsoft Corporation All rights reserved.
Licensed under the MIT License. See LICENSE in the project root for license information.

About

Example project for devcontainer usage in Visual Studio with C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published