Background: I'm building a custom build task for Azure DevOps.
- This task needs an input parameter, param1
- It's written in VS Code (v1.30.1) and TypeScript (tsc --version state: v3.2.2)
Problem When I try to debug my task I can't pass in variable values for param1. Break points are hit so that part is working.
Some code: index.ts
import tl = require('azure-pipelines-task-lib/task');
async function run() {
try {
let param1: string = tl.getInput('param1', true);
if (param1 === null || param1 === undefined) {
console.log('Should not be here...');
}
}
catch (err) {
tl.setResult(tl.TaskResult.Failed, err.message);
}
}
run();
This works fine when I run it from console with tsc;node index.js but when running with VS Code debugger I never seem to be able to pass a value to the param1 so it crashes inside the 'getInput' method.
My launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "TaskName",
"program": "${workspaceFolder}/Extensions\\BuildTasks\\TaskName\\index.ts",
"outFiles": [
"${workspaceFolder}/Extensions\\BuildTasks\\TaskName\\**\\*.js"
]
}
]}
I've also tried to add
"env": {
"param1": "thisBeString"
}
under the output files, but no success.
In desperation I've also tried using
"args": {
"--param1": "thisBeString"
}
with expected result (fail...)
I've also used inputs in my tasks.json to no success (according to this SO Q&A)
So Question is how do I pass in variable values when debugging Azure DevOps extensions in VS Code.