Chained run configurations
If you want some tasks to be carried out in sequence before the run configuration starts, you can configure that behavior with 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 final
, it will execute the run configurations specified in the dependsOn
property step-by-step:
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 test
, it will sequentially execute netstat
and then ping
.
The referenced run configurations do not need to be in the same run.json file. You can also create sequences using run configurations from run.json files in nested projects. If there is a naming conflict, the run configuration from the same run.json takes precedence.
Last modified: 11 February 2024