Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couldn't find 'project.json' in current directory - .NET Core Webapp debugging

I'm trying to setup debugging on OSX environment using .NET Core RC2 and Visual Studio Code. The following error is given when trying to run the debugger.

Couldn't find 'project.json' in current directory

Currently I've setup launch.json (see below) and chosen .NET Core Launch (web) in Visual Studio Code. As my project is in a folder called Core and sharing space with two other folders my structure looks like this.

Structure
--.vscode
------ launch.json
------ tasks.json

-- Core

-- Core.Data

-- Core.Service

launch.json

{
"version": "0.2.0",
"configurations": [
    {
        "name": ".NET Core Launch (console)",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "${workspaceRoot}/Core/bin/Debug/netcoreapp1.0/Core.dll",
        "args": [],
        "cwd": "${workspaceRoot}/Core",
        "stopAtEntry": false
    },
    {
        "name": ".NET Core Launch (web)",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "${workspaceRoot}/Core/bin/Debug/netcoreapp1.0/Core.dll",
        "args": [],
        "cwd": "${workspaceRoot}/Core",
        "stopAtEntry": false,
        "launchBrowser": {
            "enabled": true,
            "args": "${auto-detect-url}",
            "windows": {
                "command": "cmd.exe",
                "args": "/C start ${auto-detect-url}"
            },
            "osx": {
                "command": "open",
                "args": "-a chrome ${auto-detect-url}"
            },
            "linux": {
                "command": "xdg-open"
            }
        }
    },
    {
        "name": ".NET Core Attach",
        "type": "coreclr",
        "request": "attach",
        "processName": "<example>"
    }
]
}

Folder structure

enter image description here

like image 808
Rovdjuret Avatar asked May 25 '16 11:05

Rovdjuret


2 Answers

I needed to add this code

tasks.json

 "options":{
    "cwd": "${workspaceRoot}/Core"
 }
like image 93
Northstrider Avatar answered Oct 06 '22 21:10

Northstrider


None of the answers helped me. I just specified the whole path to project.json and it began to work fine.

tasks.json

{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
    {
        "taskName": "build",
        "args": [
            "${workspaceRoot}\\project.json"
        ],
        "isBuildCommand": true,
        "problemMatcher": "$msCompile"
    }
]}

So, for this particular question it would be

"args": [
        "${workspaceRoot}\\Core\\project.json"
    ],
like image 26
shkiper Avatar answered Oct 06 '22 21:10

shkiper