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 <F1>
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
.