#Trying to setup VSCode for C# Godot

1 messages · Page 1 of 1 (latest)

lavish remnant
#

Hey guys, Im completely new to this stuff, it will be my first time using both Godot and C#. I think I successfuly setup using the external editor in godot, but have problem when launching a debug in vscode, i used "C# Tools for Godot" extension for making the launch.json and tasks.json files.
When I launch the "Launch" debug option, it opens up the project in Godot editor then it shows the "Building .NET project" popup in the editor, but nothing happens after that, and the vscode has notification that says "Waiting for preLaunchTask 'build' but it never finishes. Below i included content of the tasks.json and launch.json files.
To be fair I have no idea what I'm doing 😭 Hope this is atleast a little coheirent and someone will be able to help me

#

launch.json

{
    "version": "2.0.0",
    "configurations": [
        {
            "name": "Play in Editor",
            "type": "godot-mono",
            "mode": "playInEditor",
            "request": "launch"
        },
        {
            "name": "Launch",
            "type": "godot-mono",
            "request": "launch",
            "mode": "executable",
            "preLaunchTask": "build",
            "executable": "F:\\Godot_v4.3-stable_mono_win64\\Godot_v4.3-stable_mono_win64.exe",
            // See which arguments are available here:
            // https://docs.godotengine.org/en/stable/getting_started/editor/command_line_tutorial.html
            "executableArguments": [
                "--path",
                "${workspaceRoot}"
            ]
        },
        {
            "name": "Launch (Select Scene)",
            "type": "godot-mono",
            "request": "launch",
            "mode": "executable",
            "preLaunchTask": "build",
            "executable": "F:\\Godot_v4.3-stable_mono_win64\\Godot_v4.3-stable_mono_win64.exe",
            // See which arguments are available here:
            // https://docs.godotengine.org/en/stable/getting_started/editor/command_line_tutorial.html
            "executableArguments": [
                "--path",
                "${workspaceRoot}",
                "${command:SelectLaunchScene}"
            ]
        },
        {
            "name": "Attach",
            "type": "godot-mono",
            "request": "attach",
            "address": "localhost",
            "port": 23685
        }
    ]
}
#

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "F:\\Godot_v4.3-stable_mono_win64\\Godot_v4.3-stable_mono_win64.exe",
            "type": "process",
            "args": [
                "--build-solutions",
                "--path",
                "${workspaceRoot}",
                "--no-window",
                "-q"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}
sand vault
#

I was messing with this today. You have to make the debugger ports match the ones in VSC

  • Go to the VSC plugin settings and set the LSP Server port to match Godot's Editor>Settings>Networking>Lenguage Server>Remote Port

This is my launch.json launch option:

        {
            "name": "GDScript Godot",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "C:\\Programas\\Godot\\Godot_v4.3-stable_mono_win64.exe", 
            "args": [],
            "cwd": "${workspaceFolder}",
            "stopAtEntry": false,
        }

(Replace the "program" field with your exe)

#

And this is my tasks.json

{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "build",
        "command": "dotnet",
        "type": "process",
        "args": [
          "build"
        ],
        "problemMatcher": "$msCompile",
        "presentation": {
          "echo": true,
          "reveal": "silent",
          "focus": false,
          "panel": "shared",
          "showReuseMessage": true,
          "clear": false
        }
      }
    ]
  }
#

Not sure if related, but i have this single entry in settings.json

{
    "godotTools.editorPath.godot4": "C:\\Programas\\Godot\\Godot_v4.3-stable_mono_win64.exe"
}
#

VSC plugin setting:

#

ANOTHER note: Make sure to use the NON console executable for Godot.

lavish remnant
# sand vault VSC plugin setting:

hey thanks for the answer. Which vscode extension are you using? I have "C# Tools for Godot" and only thing I can set in there is this Godot exec path.

sand vault
lavish remnant
#

to copy its launch and tasks files, but hey it works thats what matters

sand vault
#

The default tasks and launch files have never worked for me. I am not sure what is up with that.