godotengine / godot-csharp-vscode

Debugger and utilities for working with Godot C# projects in VSCode
https://marketplace.visualstudio.com/items?itemName=neikeq.godot-csharp-vscode
MIT License
145 stars 27 forks source link

Launching doesn't make a new build? #18

Closed Torguen closed 2 years ago

Torguen commented 3 years ago
3.3.2 stable mono oficial **OS/device including version:**

win10 64

Issue description:

I am using "launch" but a new version is not created with my new code. It seems that launching does not recompile the game and execute this new version, am I wrong?

Screenshots of issue:

raulsntos commented 3 years ago

You are right, it does not build the game, it only executes it. I actually prefer it that way because then I can just launch the game without having to recompile everytime. To get the behavior you are looking for you can add a preLaunchTask:

.vscode/launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "godot-mono",
            "request": "launch",
            "mode": "executable",
            "preLaunchTask": "build",
            "executable": "godot",
            "executableArguments": [
                "--path",
                "${workspaceRoot}"
            ]
        }
    ]
},

.vscoded/tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "msbuild",
            "args": [
                // Ask msbuild to generate full paths for file names.
                "/property:GenerateFullPaths=true",
                "/t:build",
                // Do not generate summary otherwise it leads to duplicate errors in Problems panel
                "/consoleloggerparameters:NoSummary"
            ],
            "group": "build",
            "presentation": {
                // Reveal the output only if unrecognized errors occur.
                "reveal": "silent"
            },
            // Use the standard MS compiler pattern to detect errors, warnings and infos
            "problemMatcher": "$msCompile"
        }
    ]
}

This build task was generated by vscode:

  1. Open the Command Palette (Ctrl + Shift + P) and select Tasks: Configure Task image

  2. Select Create tasks.json file from template image

  3. Select MSBuild or .NET Core (If not sure take a look at which Build tool is selected in Godot Editor settings, I think the default is dotnet CLI so .NET Core) image


Alternatively, you can use the Godot CLI to compile the project with a task like this:

.vscoded/tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "godot",
            "type": "shell",
            "args": [
                "--build-solutions", // Opens the editor to build the game
                "--path", "${workspaceRoot}", // Specifies the game project directory
                "--no-window", // To hide the editor that builds
                "-q" // To close the editor after building
            ],
            "group": "build",
            "presentation": {
                "reveal": "silent"
            },
            "problemMatcher": "$msCompile"
        }
    ]
}
Torguen commented 2 years ago

Where did that come from? I never did that. Captura2 Thanks for the help guys.

raulsntos commented 2 years ago

It's automatically done by Github when creating an issue, it's specified in the template:

https://github.com/godotengine/godot-csharp-vscode/blob/d573a970bf7efbeb873c73fc49204f12ab77a064/.github/ISSUE_TEMPLATE/bug-report.md?plain=1#L5-L6