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
28
votes
2 answers

How to chain tasks in Visual Studio Code using only tasks.json?

I have been ploughing through the documentation of Visual Studio Code to figure out how to add multiple consecutive tasks to the tasks.json file. The tasks array only allows for creating different arguments to the same command. In this example the…
Kokodoko
  • 26,167
  • 33
  • 120
  • 197
20
votes
6 answers

Visual Studio Code: Could not find the preLaunchTask 'build'?

I have created a new .NET Core application with the command: dotnet new console -o test When I try to run it in the Visual Studio Code debugger, I get: Could not find the preLaunchTask 'build'? Visual Studio Code generated these files for…
OlavT
  • 2,496
  • 4
  • 31
  • 56
19
votes
4 answers

Visual Studio Code: How to automate a simple regex-find and replace?

I try to create a simple regex-find and replace task in Visual Studio Code. Currently I copy from the AD some Users to a temporary file in Visual Studio code and remove the "CN=" at the beginning of the line and all the aditional informations after…
Oskar
  • 293
  • 1
  • 2
  • 8
19
votes
5 answers

Kill Process that is created from running a task

I am launching a task and it works great but its a task that stays running in the current shell. Is there anyway to kill this task from the editor when you are done?
Dan Vega
  • 1,097
  • 1
  • 14
  • 23
18
votes
4 answers

Is there a way to get a pickString dynamically populated in a VS Code task?

I'd like to provide a list of strings as a pickString for a task. The list of strings will be a list of folder names, which I can get from PowerShell, but I'm not sure how to display this list in a task. How can I set up my task and input so this…
user1668958
  • 181
  • 1
  • 3
18
votes
4 answers

Launch.json: how to reference an environment variable

In order to define my environment variables in a single place a configured a task in which a run a shell script. The task is run as preLaunchTask in my launch.json. In my launch.json I now try to reference the environment variables I configured in…
Dunken
  • 8,481
  • 7
  • 54
  • 87
17
votes
2 answers

Is there a way to set up a shortcut to call Build Tasks in VS Code?

Currently, I have a Build Task set up in Visual Studio Code (not Visual Studio). When I press Ctrl+Shift+B, I get a list of my build tasks, I then have to select my task and then it will compile and run my program. Is there an easier way to do…
Aaron Franke
  • 3,268
  • 4
  • 31
  • 51
16
votes
1 answer

Working directory of Visual Studio Code tasks

What is the working directory of a Visual Studio Code task? According to the official documentation, the default should be the workspace directory, i.e., workspaceFolder, but running a task which simply executes echo $PWD, it shows the parent…
16
votes
17 answers

vs code not opening up in windows

whenever i try to open my vs code editor, nothing happens it doesn't launch and even there are no errors..!! And i am confused what's wrong here in my vs code. Please anyone help me fix it..!! Below are the verbose command i typed in the…
p4avinash
  • 548
  • 2
  • 4
  • 15
16
votes
3 answers

Create multiple terminals and run commands in VSCode

I'm on a Mac . I'm trying to explore a way to create 4 Terminals as soon as I dbl-clicked on my workspace file. I've tried to get one working, but I seem stuck { "folders": [ { "path": "/Users/bheng/Sites/laravel/project" …
code-8
  • 54,650
  • 106
  • 352
  • 604
15
votes
2 answers

Tasks are only available on a workspace folder?

Can't find an simple, basic solution anywhere for this problem so I figured it was worth posting it here. When I go to run my code as a task, I get the following message: "Tasks are only available on a workspace folder" - I can't find a solution…
Leighton B
  • 153
  • 1
  • 1
  • 4
15
votes
4 answers

How to jump to build error in Visual Studio Code?

I'm using Visual Studio Code (Version 1.8.1) on Linux. When there is a build error and I click on the line that contains the error it doesn't jump to the corresponding line in the code. Is there a way to make Visual Studio Code behave the same as…
Etay Meiri
  • 336
  • 1
  • 2
  • 4
14
votes
2 answers

Set environment variables in task.json in vscode for WSL

I tried to set environment variables for my Visual Studio Code tasks that will run in my Windows Subsystem Linux. However, it does not seem to work. Here is my tasks.json: { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the…
13
votes
3 answers

Can preLaunchTask and launch start within the same terminal in VSCode?

I am debugging my CPP code with VSCode. I need to use a preLaunchTask to set my environment before my code run. So my code should run after preLaunchTask right in the same terminal. But it start in two different terminal now. How can I do with…
HaoQChen
  • 131
  • 3
13
votes
1 answer

VSCode: Open new terminal as part of task?

Visual Studio Code was just updated to allow running a task and having them open in a split terminal. This is great, however I'm looking for one more thing to make this perfect. I would like to be able to open a total of 3 terminals via a task. One…
BlueCaret
  • 4,719
  • 7
  • 30
  • 48
1
2
3
37 38