Reputation: 901
Is there a way to make "global" tasks, or do I always need to copy the same tasks.json
into every project directory? VSCode seems to require that the task be in a .vscode
directory within the current project folder.
Upvotes: 68
Views: 21512
Reputation: 51040
Use the user tasks.json file, which you can open with the Tasks: Open User Tasks
command in the command palette. Upon using it for the first time / when the file doesn't exist, it will prompt you to select a template to help get you started. The file is located in the same directory as user settings. Profiles can also have a default tasks.json file.
The relevant release note is here in the January 2020 release notes:
Tasks declared in
tasks.json
are now supported at the User Settings level. If you have a build script that you use across many projects, or if you don't want your tasks in a project folder, you can add your tasks in the usertasks.json
file. [...] these tasks will be available across all folders and workspaces. Only theshell
andprocess
task types are supported here.
I think that last bit about only shell
and process
types is outdated / became outdated at some point in later releases. I can currently get suggestions for other task types in the type
property, and can select those tasks from the task selection quick pick menu.
The relevant historical issue ticket is: Test user level tasks #89343.
Upvotes: 1
Reputation: 65463
I'm on the VSCode team. As of VSCode 1.8, global configuration is not supported, but the feature is on our radar: https://github.com/Microsoft/vscode/issues/1435
Please let us know on GitHub if you have any suggestions on how this should behave.
Upvotes: 26
Reputation: 7660
User level tasks is an available feature since VSCode January 2020 (version 1.42).
From the Release Notes:
Tasks declared in
tasks.json
are now supported at the User Settings level. If you have a build script that you use across many projects, or if you don't want your tasks in a project folder, you can add your tasks in the usertasks.json
file. Run the Tasks: Open User Tasks command to create user level tasks and these tasks will be available across all folders and workspaces. Only theshell
andprocess
task types are supported here.
In the Command Palette (CTRL + SHIFT + P) type:
> Tasks: Open User Tasks
Upvotes: 44
Reputation: 43
Feature is now supported in VSCode-Insiders version, just create a tasks.json where settings.json is located. (On windows it's "AppData\Roaming\Code - Insiders\User") Global tasks will be overwritten if project's tasks.json exists.
Upvotes: 2
Reputation: 16144
I found that Extension: Global Config
Copies global config files (settings.json, tasks.json, etc.) to workspace config folder
https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.global-config
Upvotes: 6