VSCode 可以在发布过程后自动打开发布的文件夹吗?

问题描述 投票:0回答:1

我在VSCode中的task.json文件如下。

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "dotnet",
      "task": "build",
      "problemMatcher": ["$msCompile"],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "label": "dotnet: build"
    },
    {
      "label": "publish user",
      "command": "dotnet",
      "type": "process",
      "args": [
        "publish",
        "API_V2.sln",
        "-c",
        "Release",
        "-o",
        "../../../../user/Downloads/API_Publish"
      ],
      "problemMatcher": "$msCompile"
    }

我可以毫无问题地发布。进程完成后,Finder 窗口会自动打开吗?

c# visual-studio-code publish
1个回答
0
投票

在您的发布用户任务中,在对象中添加演示属性。 在演示文稿属性内,创建一个设置为始终的显示属性。 然后,添加一个带有包含 shell 命令的数组的 postCommand 属性,以打开 Finder 窗口。

{
  "type": "dotnet",
  "task": "build",
  "problemMatcher": ["$msCompile"],
  "group": {
    "kind": "build",
    "isDefault": true
  },
  "label": "dotnet: build"
},
{
  "label": "publish user",
  "command": "dotnet",
  "type": "process",
  "args": [
    "publish",
    "API_V2.sln",
    "-c",
    "Release",
    "-o",
    "../../../../user/Downloads/API_Publish"
  ],
  "problemMatcher": "$msCompile",
  "presentation": {
    "reveal": "always"
  },
  "postCommand": [
    "open ../../../../user/Downloads/API_Publish"
  ]
}
© www.soinside.com 2019 - 2024. All rights reserved.