Visual studio code Visual Studio代码:使用多个任务运行预启动任务
我正在尝试找出如何在launch.json文件的prelaunchtask中一次运行多个任务 我在tasks.json中的代码如下:Visual studio code Visual Studio代码:使用多个任务运行预启动任务,visual-studio-code,vscode-settings,vscode-tasks,Visual Studio Code,Vscode Settings,Vscode Tasks,我正在尝试找出如何在launch.json文件的prelaunchtask中一次运行多个任务 我在tasks.json中的代码如下: "version": "2.0.0", "tasks": [ { "label": "CleanUp_Client", "type": "shell", "command": "rm", "args": [ "-f", "Client"
"version": "2.0.0",
"tasks": [
{
"label": "CleanUp_Client",
"type": "shell",
"command": "rm",
"args": [
"-f",
"Client"
],
},
{
"label": "Client_Build",
"type": "shell",
"command": "g++",
"args": [
"-g",
"client.cpp",
"-o",
"Client",
"-lssl",
"-lcrypto"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$gcc"
}
]
在launch.json的preLaunchTask参数中,如果我只放置构建任务,那么它可以工作,但是我希望运行多个任务,在本例中是CleanUp_客户端和Client_构建
我尝试添加另一个preLaunchTask-但是看起来您只能使用该参数一次,因此我尝试:
“预启动任务”:“构建”+“清理”,
“预启动任务”:“构建”;“干净”,
“预启动任务”:“构建”和“清理”
“预启动任务”:“构建”和“清理”
所有这些都没有成功,语法不正确
同样作为第二部分,我想知道这其中的团体部分是如何工作的,以及它对“isDefault”意味着什么:真的
供您参考:这里有一些有用的东西。基本上,您可以创建另一个任务,其中包括希望在启动前任务中使用
dependsOn
关键字运行的所有其他任务
参考代码:
"tasks": [
{
"label": "CleanUp_Client",
"type": "shell",
"command": "rm",
"args": [
"-f",
"Client"
]
},
{
"label": "Client_Build",
"type": "shell",
"command": "g++",
"args": [
"-g",
"client.cpp",
"-o",
"Client",
"-lssl",
"-lcrypto"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$gcc"
},
{
"label": "Build",
"dependsOn": [
"CleanUp_Client",
"Client_Build"
]
}
]
在这种情况下,您可以将预启动任务设置为“Build”,它将同时运行这两个任务
我很好奇是否有其他人知道从launch.json preLaunchTask运行多个任务的替代方案或正确语法。这是否仍然适用于您?我以这种方式配置了我的设置,但vscode调试器只是挂起。在代码1.39.2中,我能够将多个任务链接在一起,只要它们不是
构建类型。如果列表中包含所有build
任务,则所有任务都会失败。这看起来像是Visual Studio代码错误。