如何在 VSCode 中设置默认发布操作

Bas*_*sie 5 c# asp.net-core-mvc .net-core visual-studio-code

从 VSCode 发布我的 asp 应用程序时,我使用命令

dotnet publish -c release -o Z:\inetpub\wwwroot\Tools
Run Code Online (Sandbox Code Playgroud)

有没有办法使它成为默认发布命令,这样我就不需要每次都在终端中输入它?

Ste*_*t_R 5

您可以将其设置为VS Code 任务

像这样的东西:

{
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "publish",
            "type": "shell",
            "command": "dotnet publish",
            "args": [
                "-c", "release",
                "-o", "Z:\inetpub\wwwroot\Tools"
            ],
            "presentation": {
                "reveal": "always",
                "panel": "new"
            }
        },
    ]
}
Run Code Online (Sandbox Code Playgroud)