Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create tasks for a VSCode workspace

I am developing some embedded code using VSCode as my IDE. I have created a workspace and I have two projects in it. When I have only a single project I can create my build and launch files, however, what I would like to do is to have build tasks and launch configurations for the whole workspace.

I have tried to manually create a ".vscode" folder in the workspace and added a tasks.json to it. However, when I select build VSCode is not presenting the tasks in the tasks.json file as options. It says there are no build tasks defined.

The VSCode documentation seems to suggest it is possible to have workspace-level build tasks, however I have failed to find how to configure those.

like image 270
Sid Avatar asked Dec 10 '25 07:12

Sid


2 Answers

As for VSCode version 1.17.0 one can easily create workspace-level tasks by selecting "Open Workspace Tasks" from the Command Palette

like image 135
Antonio Avatar answered Dec 13 '25 09:12

Antonio


Good question, as I just found out the GUI of VSCode is not very helpful. To create a tasks.json go to Terminal / Configure Tasks... and select Create tasks.json from template... this will create a .vscode folder and a tasks.json file in it. Unfortunately this is not want you want, instead the tasks should logicly be created in the workspace file. But what you could do is take the created tasks.json contents cut and paste it to the .workspace file.

Or you could open the .workspace file after the "folders" section type a comma, newline and start typing ta VSCode will autocomplete this with a tasks section.

like image 26
theking2 Avatar answered Dec 13 '25 09:12

theking2