Could not find the preLaunch task 'build'

前端 未结 4 2083
死守一世寂寞
死守一世寂寞 2020-12-14 06:05

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 Cod

4条回答
  •  一生所求
    2020-12-14 06:53

    On Linux, to get the build command to work, I needed to change the tasks.json file from:

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "label": "build",
                "command": "dotnet build",
                "type": "shell",
                "args": [
                    // Ask dotnet build to generate full paths for file names.
                    "/property:GenerateFullPaths=true",
                    // Do not generate summary otherwise it leads to duplicate errors in Problems panel
                    "/consoleloggerparameters:NoSummary"
                ],
                "group": "build",
                "presentation": {
                    "reveal": "silent"
                },
                "problemMatcher": "$msCompile"
            }
        ]
    }
    

    to:

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "label": "build",
                "command": "dotnet",
                "type": "shell",
                "args": [
                    "build"
                    // Ask dotnet build to generate full paths for file names.
                    "/property:GenerateFullPaths=true",
                    // Do not generate summary otherwise it leads to duplicate errors in Problems panel
                    "/consoleloggerparameters:NoSummary"
                ],
                "group": "build",
                "presentation": {
                    "reveal": "silent"
                },
                "problemMatcher": "$msCompile"
            }
        ]
    }
    

    the reason for this is the fact that Linux will treat the task generated by VSC as running command "dotnet build" instead of "dotnet" with the parameter of "build". Without the change you will receive "dotnet build: command not found" with exit code 127

提交回复
热议问题