Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VS代码:can';t编译c#_C#_.net_Visual Studio Code - Fatal编程技术网

VS代码:can';t编译c#

VS代码:can';t编译c#,c#,.net,visual-studio-code,C#,.net,Visual Studio Code,当我在可视代码中单击“开始调试”时,我收到此错误。没有谷歌搜索结果有效,那么我该如何修复它呢?我正在尝试编译C代码 The preLaunchTask 'build' terminated with exit code 1. 我在launch.json文件下面添加了一些代码,在VS代码的另一个文件中添加了一些代码,因为我不确定这是否有助于查看它们 launch.json: { "version": "0.2.0", "configurations": [ {

当我在可视代码中单击“开始调试”时,我收到此错误。没有谷歌搜索结果有效,那么我该如何修复它呢?我正在尝试编译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}"
        }
    ]
}

在launch.json文件中配置了一个
preLaunchTask
。它是在执行脚本之前运行的任务。该任务是tasks.json文件中的“build”。它失败了,返回的非零错误代码表明了这一点。您需要打开tasks.json配置文件,查看“构建”任务需要什么,然后找出失败的原因

我已经用tasks.json和launch.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"
        }
    ]
}