debuggingvisual-studio-codecakebuild

Debug Cake Frosting project in VSCode


I found an old question related to debugging a cake script in vscode.

How do I debug a "frosting" project?

I added this to .vscode/launch.json, but it runs the project without stopping at breakpoints:

{
  "name":        "cake",
  "type":        "coreclr",
  "request":     "launch",
  "cwd":         "${workspaceFolder}/build",
  "program":     "dotnet",
  "args":        [ "run" ],
  "stopAtEntry": false
}

Solution

  • One must run the frosting console programme (Build.dll).

    .vscode/tasks.json:

    {
      "label": "build-cake",
      "command": "dotnet",
      "type": "process",
      "args": [
        "build",
        "${workspaceFolder}/build/Build.csproj",
        "/property:GenerateFullPaths=true",
        "/consoleloggerparameters:NoSummary"
      ],
      "problemMatcher": "$msCompile"
    },
    

    .vscode/launch.json

    {
      "name": "cake",
      "type": "coreclr",
      "request": "launch",
      "preLaunchTask": "build-cake",
      "cwd": "${workspaceFolder}/build",
      "program": "${workspaceFolder}/build/bin/Debug/net6.0/Build.dll",
      "args": [],
      "console": "internalConsole",
      "stopAtEntry": false
    }