Visual Studio:preLaunchTask'build'以退出代码129终止

时间:2017-08-07 22:03:03

标签: c# json visual-studio

我已经在运行Linux Mint的设备上安装了Visual Studio但是每当我尝试在visual studio中运行c#程序时它会抛出错误

The preLaunchTask 'build' terminated with exit code 129.

它为我提供了选择调试的选项,但随后它说:

No executable found matching command "dotnet-/home/XXXX/Documents/C# Practice/bin/Debug/netcoreapp1.0/HelloWorld.dll"

(XXXX只是因为我不想分享我的名字)

这是 launch.json 文件

{
"version": "0.2.0",
"configurations": [

    {
        "name": ".NET Core Launch (console)",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/HelloWorld.dll",
        "args": [],
        "cwd": "${workspaceRoot}",
        "stopAtEntry": false,
        "console": "internalConsole"
    },
    {
        "name": ".NET Core Launch (web)",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/HelloWorld.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": "2.0.0",
"tasks": [
    {
        "taskName": "build",
        "command": "dotnet",
        "type": "shell",
        "group": "build",
        "presentation": {
            "reveal": "silent"
        },
        "problemMatcher": "$msCompile"
    }
]

}

1 个答案:

答案 0 :(得分:1)

如果任务是像我的情况那样构建,你只需要为dotnet ("command": "dotnet") -> ("command": "dotnet build")添加命令的缺失部分,或者你要做的任何任务。

我在JSON中的任务:

{
    "version": "2.0.0",
    "tasks": [{
        "taskName": "build",
        "command": "dotnet build",
        "type": "shell",
        "group": "build",
        "presentation": {
            "reveal": silent"
        },
        "problemMatcher": "$msCompile"
}