-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a 'clean' task to C# task list #45
Comments
Encountered the same issue with Godot 4. Looks like when launching game from Godot editor, the latter does not recompile source code. |
The Godot editor and the extension's build task should work and there should be no need for a clean task. A clean task would also prevent incremental builds. If a project launched with an outdated assembly it likely failed to compile, if the build task failed VSCode should show a dialog complaining about it but I think our current build task that uses Using the Keep in mind that Godot 4.0 is not supported by this extension, so it won't work regardless of what I just said. |
Why would a clean task prevent incremental builds? You don't need to run it every single time. Just provide it as an option to help fix things which you can run when the source and the binaries get out of sync for whatever reason. |
Yes I meant running it on every build would prevent incremental builds. I feel like this is unrelated to Godot and the C# extension would be a better fit to provide this task. I'm still not convinced that this task is necessary though, binaries should not get out of sync and I'd be more interested in investigating the real cause of the issue than providing a hacky patch. But if you still want a clean task it's very easy to create your own. This should do it: {
"label": "clean",
"command": "dotnet",
"type": "process",
"args": [
"clean",
"${workspaceFolder}"
],
"problemMatcher": "$msCompile"
} |
Do you know how to invoke the clean task from within Visual Studio Code? I can't find a mechanism for it. |
Your {
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "clean",
"command": "dotnet",
"type": "process",
"args": [
"clean"
],
"problemMatcher": []
}
]
} To invoke those, you can either:
You can also chain tasks to run in sequence or in parallel. Read this. (Hint: you need to use Please note, that |
Off-topic For those who are curious about my tasks.json and launch.json configurations: tasks.json: {
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile",
}
]
} launch.json: {
"version": "0.2.0",
"configurations": [
{
"name": "Select and Launch Scene",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// Below is absolute path to your Godot.exe. Or use PATH env. var. to shorten it to something like "godot4"
"program": "D:\\\\Programs\\\\Utils\\\\Godot4.0b2\\\\godot4.exe",
"args": [
"${input:pickScene}"
],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "Launch Main Scene",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "D:\\\\Programs\\\\Utils\\\\Godot4.0b2\\\\godot4.exe",
"args": [
"--path",
"${workspaceFolder}"
],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "Attach",
"type": "coreclr",
"request": "attach"
}
],
"inputs": [
{
"id": "pickScene",
"type": "command",
"command": "filePicker.pick",
"args": {
"masks": "**/*.tscn",
"display": "filePath",
"output": "filePath"
}
}
]
} NOTE: you need this extension to use launch configuration "Select and Launch Scene". Actually, Godot 4 makes this (godot-csharp-vscode) extension obsolete. (Sorry, I didn't want to hurt anyone here 👉👈 ). There is, actually, a slight problem (will reference in separate issue later on godot repo) with Intellisense and Godot's source generation. Sometimes you will be redirected to non-existed files (with path somewhere in your project's .godot folder) when going for definitions of Godot classes. |
I am sometimes encountering odd bugs where my code is behaving as if other code I have written does not exist or has not been edited. When I encounter similar situations in a C++ environment, it usually means my object files have become out of sync with my source and usually running a 'make clean' will fix it. It would be very helpful to have a similar feature in the C# tasks so that you can make sure that your bugs are actually there and not the result of out of date assemblies.
The text was updated successfully, but these errors were encountered: