Create an ESP-IDF Project
You can start a project in three ways:
The first option is recommended because it allows to configure the project. The second and third options create the project with the current workspace folder configuration.
Using ESP-IDF: New Project
In Visual Studio Code:
Navigate to
View
>Command Palette
.Type
ESP-IDF: New Project
and select the command to launch the New Project wizard.Choose the project name.
Choose the location for the new project.
Select the Espressif board you are using.
Select the serial port of the device (a list of currently connected serial devices appears in the dropdown).
Note
If you are not sure about the serial port name, refer to Establish Serial Communication.
Note
Please refer to Configuration of OpenOCD for Specific Target to select the appropriate OpenOCD configuration file based on your hardware.
Optionally, you can import any ESP-IDF component directory
component-dir
to the new project. This will copy it to the new project’scomponents
subdirectory (<project-dir>/components/component-dir
).Click the
Choose Template
button.Select ESP-IDF from the dropdown if you want to use a template.
Note
If you want to create a blank project, choose ESP-IDF
sample_project
or Extensiontemplate-app
.Choose your desired template and click the
Create Project Using Template <template-name>
button, where<template-name>
is the name of the selected template.After the project is created, a notification window will appear, asking whether to open the newly created project.

Using ESP-IDF: Show Examples Projects
In Visual Studio Code:
Navigate to
View
>Command Palette
.Type
ESP-IDF: Show Examples Projects
and select the command to create a new project from ESP-IDF examples.Select
ESP-IDF
from the dropdown. A window will appear, showing a list of ESP-IDF examples.When you select an example, the README file will appear along with a
Create project using example example_name
button.Choose a destination for the new project. A notification will prompt you to open the folder in a new window.

Opening an Existing ESP-IDF Project
ESP-IDF projects follow this directory structure:
- myProject/
- CMakeLists.txt
- sdkconfig
- components/ - component1/ - CMakeLists.txt
- Kconfig
- src1.c
- component2/ - CMakeLists.txt
- Kconfig
- src1.c
- include/ - component2.h
- main/ - CMakeLists.txt
- src1.c
- src2.c
- build/
In Visual Studio Code:
Navigate to
View
>Command Palette
.Type
ESP-IDF: Import ESP-IDF Project
and select the command to import an existing ESP-IDF project.
This command adds both Visual Studio Code configuration files (settings.json, launch.json) and Docker container files (Dockerfile and .devcontainer.json).
The next step is to Connect a device.
Adding Visual Studio Code configuration files and Docker container
In Visual Studio Code, go to File
> Open Folder
and open a directory containing a CMakeLists.txt
file in the root (e.g., myProject), which follows the ESP-IDF structure.
To add Visual Studio Code configuration files (settings.json, launch.json):
Navigate to
View
>Command Palette
.Type
ESP-IDF: Add .vscode Configuration Folder
and select the command.
To open the project within the ESP-IDF Docker container:
Navigate to
View
>Command Palette
.Type
ESP-IDF: Add Docker Container Configuration
and select the command to add the.devcontainer
directory to your current directory.Navigate to
View
>Command Palette
.Type
Dev Containers: Open Folder in Remote Container
and select the command to open the existing project inside the container created from the Dockerfile in the previous step.