Publish Web Deploy using VS Code

后端 未结 3 1929
一整个雨季
一整个雨季 2021-02-01 03:41

In Visual Studio, I use the \"publish web\" feature to do some web.config transforms, and publish a WebAPI project to our server. The publishing is done using Web Deploy.

<
3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-01 04:26

    Assuming you are using the latest vscode now (1.7.x). You can use Visual Studio Code's Task Runner.

    First, you would need to configure the task runner by pressing and enter task. Select Tasks: Configure Task Runner.

    A new file tasks.json would be created by vscode with following content.

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "0.1.0",
        "command": "msbuild",
        "args": [
            // Ask msbuild to generate full paths for file names.
            "/property:GenerateFullPaths=true"
        ],
        "taskSelector": "/t:",
        "showOutput": "silent",
        "tasks": [
            {
                "taskName": "build",
                // Show the output window only if unrecognized errors occur.
                "showOutput": "silent",
                // Use the standard MS compiler pattern to detect errors, warnings and infos
                "problemMatcher": "$msCompile"
            }
        ]
    }
    

    Second, now you would need to add the new publish task. With the answer given by @Rolo, you can add a new task in the tasks array:

        {
            "taskName": "publish",
            // Always show errors from builds.
            "showOutput": "always",
            "args": [
                "/p:DeployOnBuild=true",
                "/p:PublishProfile=Test"
            ]
        }
    

    Third, once the tasks.json is completed. You can use the publish task by pressing Ctrl+P (or Cmd+P on Mac), and type task publish.

提交回复
热议问题