-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Build Does Not Detect C# Extensions (or any .cs files that do not contain nodes) #14932
Comments
I assume you created it from VS Code, which does not update the csproj. Godot cannot assume the file is part of the game csproj (you could have other C# projects). Godot only makes this assumption when creating the script from the Godot editor, when the script is attached to a node and when the script is used as an AutoLoad (this last one is pending 😄). You must either create the script from Godot or use an IDE like MonoDevelop or Visual Studio. EDIT: Found this VS Code extension: https://marketplace.visualstudio.com/items?itemName=lucasazzola.vscode-csproj BTW, I plan to add a panel to view and edit includes and references in the game project, in order to make it friendlier than editing the project file. This will happen after 3.0 though. |
We have now entered release freeze for Godot 3.0 and want to focus only on release critical issues for that milestone. Therefore, we're moving this issue to the 3.1 milestone, though a fix may be made available for a 3.0.x maintenance release after it has been tested in the master branch during 3.1 development. If you consider that this issue is critical enough to warrant blocking the 3.0 release until fixed, please comment so that we can assess it more in-depth. |
The VS code extension is a decent workaround until then, although not perfect. I can wait. |
Are there any updates on this issue? |
@neikeq can you update the title of this issue to reflect the actual issue since c# extensions actually work fine with godot. This is a file being included in the csproj file issue w/ vscode/godot editor. Which is a non issue in most IDE's. |
I can't say I've tested this, but a workaround for this, although kinda hacky, is to add the following line before the <ItemGroup>
<Compile="**\*.cs" />
</ItemGroup> This should make msbuild automatically compile all You can also Make it only do specific directories by making |
I guess the best will be to watch the project directory for source files added or removed outside the Godot editor and show a dialog asking for confirmation from the user to apply these actions to the project. |
Related to #12917. |
Might be worth adding some sort of Godot option to generate the csproj with the wildcard to grab all C# files. I know i've been struggling with my csproj sometimes missing files, i'd have certainly opted for something more automated if given the option. Unity does that thing where it rebuilds the csproj when it detects a new script in the project dir, maybe Godot doesn't need to go that far though. |
Worked great for me :) But had to change it to following to get the project to compile.
|
Please re-test with Godot 3.2.3 and/or the master branch. Both of these use the new C# project format, so issues related to the As of Godot 3.2.3, using this as your <Project Sdk="Godot.NET.Sdk/3.2.3">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
</Project> If this issue does still exist for you, then you will need to include a minimal reproduction project. |
Works for me in Godot 3.3.3 as you said. |
Closing as resolved per @Tobi-Mob's comment. Thanks for testing 🙂 |
Godot version:
3.0 beta 2
OS/device including version:
Windows
Issue description:
When you make an extension method in another .cs class, build fails because it cannot find the extension you are attempting to reference.
Steps to reproduce:
EDIT: I did more research and it looks like that Godot neglects to include .cs files in the solution that do not contain nodes. This is undesirable.
The text was updated successfully, but these errors were encountered: