To configure Visual Studio Code to debug C# scripts on OSX, I followed through all the steps listed in the article below:
Debugging C# on OSX with Visual Studio Code
When I tried to debug the sample C# script, Visual Studio Code reported this error:
Could not find the preLaunch task 'build'
As a consequence, I could not inspect the variables defined in the script.
This is a copy of the launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch console application",
"type": "mono",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/Program.exe",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false
}
]
}
This is a copy of the tasks.json file:
{
"version": "0.1.0",
"command": "mcs",
"args": [
"-debug",
"Program.cs"
],
"showOutput": "silent",
"taskSelector": "/t:",
"tasks": [
{
"taskName": "exe",
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}
How do I resolve this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…