我正在使用vscode运行tasks.json中定义的任务来编译文件夹中的typescripts文件。但我不断收到错误“Typescript TS5042 Build:Option'项目'不能与命令行上的源文件混合”。
当我从命令行(powershell)运行此命令时,它工作正常!
我的tasks.json
{
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "CompileApp",
"args": [
"--p", "app/"
],
"isBuildCommand": true,
"problemMatcher": "$tsc"
}
]
}
答案 0 :(得分:2)
您需要将以下选项添加到任务部分" suppressTaskName"。在你的情况下,它看起来像这样:
code
{
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "CompileApp",
"args": [
"--p", "app/"
],
"isBuildCommand": true,
"problemMatcher": "$tsc",
"suppressTaskName": true
}
]
}