Question:
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
"version": "0.1.0", "command": "${workspaceFolder}/Invoke-Task.ps1", /*"command": "powershell", creates subshell so doesn't work*/ "isShellCommand": false, "args": [], "showOutput": "always", "echoCommand": true, "suppressTaskName": true, "tasks": [ { "taskName": "task1", "args": ["task1"] }, { "taskName": "task2", "args": ["task2"] } ] |
Answer:
I am sorry, but you are not correctly editing the .vscode/tasks.json
file.
In your scenario, lets say you have some powershell script ./scripts/mycustomPSscript.ps1
you want to run as a vscode task
. For such goal, edit the tasks file so it follows the below example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
{ "version": "2.0.0", "tasks": [ { "label": "Run-some-custom-script", "detail": "Prepare some ENV variables for the deployment", "type": "shell", "command": "./../scripts/mycustomPSscript.ps1", "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared", "showReuseMessage": true, "clear": false } } ] } |