问题描述
总结
我不希望在tasks.json 上使用Remove-Item 进行良好的行为。 我怎样才能做到这一点?知道的请告诉我。
想要的行为
我想在“压缩”任务之前删除 zip 文件。所以我设置了顺序任务“构建”。因为我想要一次性命令“Ctrl+Shift+B”默认构建命令。但是无法处理没有 zip 文件的“压缩”任务。
代码
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0","tasks": [
{
"label": "Compress","type": "shell","command": "7z","args": [
"a","-tzip","${workspaceFolder}/WpMainTheme-child.zip","${workspaceFolder}/WpMainTheme-child"
]
},{
"label": "Delete","command": "Remove-Item","args": [
"${workspaceFolder}/WpMainTheme-child.zip","-Force"
]
},{
"label": "Build","dependsOrder": "sequence","dependsOn": [
"Delete","Compress"
],"problemmatcher": [],"group": {
"kind": "build","isDefault": true
}
}
]
}
已经试过了
“-Recurse -Force”不起作用。如何使用“Test-Path”的返回值?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)