Search code examples
c#visual-studio-code.net-coreasp.net-core-mvc

How to set default publish action in VSCode


When publishing my asp app from VSCode I am using command

dotnet publish -c release -o Z:\inetpub\wwwroot\Tools

Is there a way to make this the default publish command, so I don't need to type it into the terminal each time?


Solution

  • You could set this up as a VS Code task

    Something like this:

    {
        "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"
                }
            },
        ]
    }