当我在可视化代码中点击“开始调试”时,我收到了这个错误。没有谷歌的结果是有效的,那么我如何修复它?我正在尝试编译C#代码。
The preLaunchTask 'build' terminated with exit code 1.我在下面的launch.json文件中添加了一些代码,并为VS代码添加了另一个文件,因为我不确定它是否有助于查看它们。
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"console": "internalConsole"
},
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceRoot}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [ ],
"isBuildCommand": true,
"showOutput": "silent",
"problemMatcher": "$msCompile"
}
]
}发布于 2017-08-27 10:47:15
您的launch.json文件中配置了一个preLaunchTask。它是在脚本执行之前运行的任务。该任务是“构建”,来自您的tasks.json文件。它失败了,因为它返回了一个非零的错误代码。你需要打开你的tasks.json配置文件,看看“构建”任务需要什么,然后找出它失败的原因。
https://stackoverflow.com/questions/45901242
复制相似问题