Wednesday, January 23, 2019

Visual Studio Code Set Environment Variable for Task

I was unable to find a solution for setting an environment variable for a specific task but setting one for all tasks can be done like this:

...
"options": {
        "env": {
            "VARIABLE": "value"
        }
    },
    "tasks": [
...

That would set the environment variable VARIABLE to "value" for all tasks.