According to the documentation , you can run the program before debugging:
To start a task before the start of each debugging session, preLaunchTask name of one of the tasks specified in tasks.json.
I have not seen an example of the syntax for a "named" task, but a property called taskName in the schema documentation . I tried using this to associate my preLaunchTasks Json preLaunchTasks with a task, but that didn't work. When I ran my program, Visual Studio Code reported this error:
Could not find unique task 'launch-core'. Make sure the task exists and has a unique name.
My custom "named" task looked something like this:
{ "taskName": "launch-core", "version": "0.1.0", "command": "C:\\utils\\mystuff.exe", // The command is a shell script "isShellCommand": true, // Show the output window only if unrecognized errors occur. "showOutput": "silent", }
Then I tried to change the property name from taskName to just name based on this link . That didn't work either.
Intellisense does not give any clues on how to name the task.
Does anyone know how to uniquely name a task in a tasks.json file? What is the syntax? What is the name of the property?
Ultimately, I would like to run two or three node.js processes before starting my own node.js application. For example, I would like to launch the following three applications before my application runs in the debugger:
sh -c 'cd ./manager/ && node manager.js' sh -c 'cd ./adapter/ && node adapter.js' sh -c 'cd ./core/ && node core.js'
If I work on a Windows box, my task might look something like this:
{ "taskName": "core-launch", "version": "0.1.0", // The command is tsc. Assumes that tsc has been installed using npm install -g typescript "command": "start", // The command is a shell script "isShellCommand": true, // Show the output window only if unrecognized errors occur. "showOutput": "silent", // args is the HelloWorld program to compile. "args": [ "ACD-Manager", "/B", "/D", "./manager/", "node", "manager.js" ] }
The above task using the start cmd feature . I'm still not sure how to get several node tasks to start instead of one, but I can't even run one task because of this problem with task names.
How can I name a task in tasks.json file?