VS Code tasks.json 错误

3
这是我的tasks.json文件:
{
    "version": "0.1.0",
    "tasks": [
        {
            "taskName": "clean",
            "windows": {
                "command": "del"
            },
            "linux": {
                "command": "rm"
            },
            "args": [ "build/*" ],
            "showOutput": "never",
            "isShellCommand": true,
            "suppressTaskName": true
        }
    ]
}

每次我使用Ctrl+P并输入task clean以执行任务时,都会出现以下错误:

无法读取未定义的'args'属性

有人知道我缺少什么吗?
1个回答

3

看起来,除非在操作系统特定的“linux” / “windows”属性之外指定一个“命令”,否则VSCode不会满意,即使您正在其中一种平台上。

通过添加虚拟的“command”: "",它可以工作:

{
    "version": "0.1.0",
    "tasks": [
        {
            "taskName": "clean",
            "windows": {
                "command": "del"
            },
            "linux": {
                "command": "rm"
            },
            "command": "",
            "args": [ "build/*" ],
            "showOutput": "never",
            "isShellCommand": true,
            "suppressTaskName": true
        }
    ]
}

这对我来说似乎是一个错误。我建议你将其报告给VSCode问题跟踪器

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接