The following table lists locations where tasks definitions and binding definitions are stored, depending on the structure of your project.
| Definition type | Single-folder project | Multi-root workspace |
|---|---|---|
| Tasks | .vscode/tasks.json |
tasks key in <file-name>.code-workspace |
| Bindings | .vscode/settings.json |
settings key in <file-name>.code-workspace |
The extension provides the following pre-defined tasks that you can bind to the chosen actions:
| Pre-defined task | Description |
|---|---|
Build [pristine] |
Performs a full, pristine build by regenerating the build configuration before building. |
Build [clean] |
Cleans the build directory before building, but without regenerating the build configuration. |
Build [incremental] |
Builds only the files that have changed since the last build (incremental build). |
Flash |
Flashes the built application to the connected device. |
If you want to add custom tasks, you need to manually create them in tasks.json or the workspace configuration file. Then, you need to bind it to the action in settings.json or the workspace configuration file.
Bindings are stored in the nrf-connect.taskBindings property in the related binding configuration file. Tasks are matched to bindings using the tasks' label attribute. If a task is referenced in the configuration, but is not defined in the task configuration file or contributed by an extension, a warning message appears until the binding is removed.
You can also modify nrf-connect.taskBindings manually, which can be easier if you have many bindings or a complicated setup.
For more information on where tasks should be defined and what format they should take, read the VS Code tasks documentation.