Questions tagged [vscode-tasks]

Visual Studio Code Tasks can be used to run scripts or begin processes in order to leverage other tools to perform tasks from within Visual Studio Code.

Lots of tools exist to automate tasks like linting, building, packaging, testing, or deploying software systems. Examples include the TypeScript Compiler, linters like ESLint and TSLint as well as build systems like Make, Ant, Gulp, Jake, Rake, and MSBuild.

These tools are mostly run from the command line and automate jobs inside and outside the inner software development loop (edit, compile, test, and debug). Given their importance in the development life cycle, it is helpful to be able to run tools and analyze their results from within VS Code. Tasks in VS Code can be configured to run scripts and start processes so that many of these existing tools can be used from within VS Code without having to enter a command line or write new code. Workspace or folder specific tasks are configured from the tasks.json file in the .vscode folder for a workspace.

Extensions can also contribute tasks using a Task Provider, and these contributed tasks can add workspace-specific configurations defined in the tasks.json file.

Website:

https://code.visualstudio.com/docs/editor/tasks

566 questions
12
votes
5 answers

How to Setup VS Code For C++ 14 /C ++17

I tried to run a .cpp file from workspace but giving me this error about not adding c++11/higher flags but I have added them in task.json Error [Running] cd "c:\Users\Nuhash\Desktop\test\" && g++ main.cpp -o main &&…
sabertooth
  • 582
  • 1
  • 7
  • 23
12
votes
5 answers

Terminate another task from within a postDebugTask - VS Code

I have a debug launch configuration (launch.json) like below. { "version": "0.2.0", "configurations": [ { "name": "Current TS File", "type": "node", "request": "launch", …
Sandeep Kumar
  • 1,758
  • 1
  • 22
  • 39
12
votes
0 answers

Any source or idea, how to do delayed compound in VSCode?

I have a build task that takes at least 2 seconds to finish in tasks.json. I also have different very quick task for cleaning some files in tasks.json. I have 3 configurations in launch.json: server, server_running_on_top_of_server and client. All…
Lukas Salich
  • 959
  • 2
  • 12
  • 30
12
votes
1 answer

Is there a way to run a command with VS Code tasks?

In VS Code, I have an extension whose commands I can run by pressing F1 and searching by name. However I would like to automatically run it from a task (tasks.json). I know its full name from keyboard shortcuts.
leppaott
  • 123
  • 7
12
votes
2 answers

How to change .Net Core 2 debugger port of VSCode

I'm using Visual Studio Code (VSCode) to code .Net Core 2.0 App and would like to use the VSCode debugger for that. I created a launch.json, which works with my frontend code, but I'd like to also debug the .Net code. However my main problem is that…
ghiscoding
  • 12,308
  • 6
  • 69
  • 112
11
votes
2 answers

VSCODE: How do i enable "tasks: Allow Automatic Tasks In Folder" by default?

I want "tasks: Allow Automatic Tasks In Folder" to be enabled by default when i open a project this is the tasks.json { "version": "2.0.0", "tasks": [ { "type": "npm", "script": "gulp", "runOptions": { …
11
votes
1 answer

Get relative path of the file for tasks in vscode

I have a task defined in vscode's tasks.json file as following { "version": "0.1.0", "tasks": [ { "command": "gulp", "taskName": "eslint_task", "args": [ "eslint", …
0xC0DED00D
  • 19,522
  • 20
  • 117
  • 184
10
votes
0 answers

Is there are ways to use VSCode tasks.json dependsOn to add dependencies from other projects

I have a multi root workspace with several projects in it. Each project has its own build task that calls an external script to do the build. One project requires all the others to be built prior to it's build as it is required to link against them.…
SimonAlfie
  • 823
  • 9
  • 18
10
votes
3 answers

How to configure a VSCode Task to run a powershell script in the integrated terminal

In such a way that it is not in a sub shell. I need it to be able to prepare the environment...set environment variable. "version": "0.1.0", "command": "${workspaceFolder}/Invoke-Task.ps1", /*"command": "powershell", creates subshell so doesn't…
10
votes
2 answers

How to Set a Keyboard Shortcut to "Terminate Running Task" in VSCode?

I have my build run my application until I kill it. This works fine, but it would be nice to bind "Terminate Running Tasks" to a keyboard shortcut. Is this possible?
Kyle Brandt
  • 26,938
  • 37
  • 124
  • 165
9
votes
2 answers

How to start Azure function locally and attach debugger to process dynamically via launch.json and tasks.json?

Using .NET Core on a Mac with Visual Studio Code, I'm trying to host an Azure Function locally, and attach the debugger to it. Manually, I can get it to work by starting the function with func host start, followed by pressing the debug button in the…
9
votes
1 answer

How do I specify the include path when I build a program in VSCode?

Let's say this is my project. file structure: project_root |-- inc | |-- header.h |-- src | |-- helpers.c | |-- main.c header.h #ifndef HEADER_H # define HEADER_H void func(void); #endif helpers.c void func() { /* do something…
KIYZ
  • 412
  • 1
  • 5
  • 12
9
votes
2 answers

Using a shell command as VSCode task variable value

I am trying to define a VSCode task in tasks.json that would adapt to the specific architecture where VSCode runs. To do this, I want to get the architecture as uname --m (e.g. "aarch64" or "amd64"). My goal is to interpolate the output of uname…
francoisr
  • 4,407
  • 1
  • 28
  • 48
9
votes
1 answer

Extension API - Task Provider - Build Task example

I've built an extension for a programming language that I use and I've created hotkey shortcuts for calling the compiler executable with the currently open document's URI. I want to convert that to a build task in my extension. I have made a…
sentry07
  • 111
  • 1
  • 5
8
votes
2 answers

VSCode Task to run various node commands

I have a monorepo where I wish to create a script for starting up a specific project locally. The project is completely Node.js based. For me to set up this project locally for development, I need to run the following commands in this order: Start…
nopassport1
  • 1,821
  • 1
  • 25
  • 53
1 2
3
37 38