Chained run configurations
If you want specific tasks to run in sequence before the main run configuration starts, use the dependsOn property. For example:
{
"configurations": [
{
"type": "command",
"name": "final",
"dependsOn": ["first", "second"],
"program": "echo",
"args": ["final"]
},
{
"type": "command",
"name": "first",
"program": "echo",
"args": ["first"]
},
{
"type": "command",
"name": "second",
"program": "echo",
"args": ["second"]
}
]
}
When you run the final configuration, it will execute the configurations listed in the dependsOn property in order:
first
second
final
{
"configurations": [
{
"type": "test",
"name": "ping",
"program": "ping",
"args": ["example.com"],
"dependsOn": ["netstat"]
},
{
"type": "command",
"name": "netstat",
"program": "netstat",
"args": ["-an"]
}
]
}
When you run the ping configuration, it will first run netstat and then continue with ping.
The referenced configurations do not need to be in the same run.json file. You can also reference configurations defined in run.json files located in nested projects. If there is a name conflict, the configuration from the current run.json takes precedence.
08 May 2025