Operating system or device, Godot version, GPU Model and driver (if graphics related):
Windows 8.1 - custom Godot build (2cdfef5)
Issue description:
When you rename a .cs file from within the editor, the .csproj file doesn't get changed. This makes it so you have to open the mono project file manually to change the filename there too before you can run your Godot project again.
Steps to reproduce:
Related to #12917.
@akien-mga Of course it's related, it's the same issue :P
I remember an issue exists but I cannot find it, I had commented on it about the fact that using an IDE was usually recommended with C# (because IDEs will rename file and update csproj accordingly as well as preserving all build options)
This is the related issue: #12415
@neikeq
My opinion is still that we just have a fixed solution and project naming scheme like GodotProject.sln/csproj. More things need to be renamed when a project needs to be renamed than just the files. Also the assembly output needs to be renamed. It seems much more straight forward to just have a static name for the main solution and project file.
I'm not stuck on this idea, but if the renaming bug isn't moving forward (and I also have no time/motivation to take a stab at it) then I think the easiest thing is to just have a static solution and project naming scheme.
@NathanWarden Please no static solutions (Project is less problematic !). Unity does the same, And it doesn't let you work on any additional projects in the solution.
@Zylann I think your solution (Always using an IDE for C#) is better, because there are lots of IDEs for C# out there, why reinvent the wheel inside the engine ? The only problem here is that if the script file is renamed from the IDE, then the Engine loses the file and therefore makes its content (The C# codes) a built-in resource on the node it was attached to.
I think we need a way to either :
I can try working on this, I'll try to make it not regenerate or overwrite the .csproj file.
Why not move to the new .csproj format
So we don't have to have to deal with that kind of issue
Mono can build projects that uses the new .csproj format
He's probably talking about this and it seems like a really good solution! I'll open an issue for this.
@Nufflee the new .csproj format treat the solution as a folder, it includes all the .cs inside the project folder for building, so you don't have to edit the .csproj file manually if you add/remove a file for example
I don't know how the mono integration works, but this should work
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
</PropertyGroup>
</Project>
@Scellow opened an issue here.
Yeah, why not just use new .csproj format? This issue would automatically be gone then.
This issue might disappear if we switch to the new csproj format, but as far as I know this is only available in .NET Core, which we don't use. Perhaps if we switch to .NET 5 in the future?
In any case, not going to be done for 3.2, and I assume won't be done for 4.0 either. Perhaps 4.1?
using godot 3.2.1 and this error still happends ->
aimed for godot 4? @aaronfranke
godot plz fix!
maybe a workaround would be a batch script that reads for file system changes and then updates the .csproj file.
I think the plan is to move to the new .csproj
format by the time Godot 4.0 is released, so this should hopefully be fixed.
maybe a workaround would be a batch script that reads for file system changes and then updates the .csproj file.
If there's a standalone tool for making changes to a .csproj
file safely, you could plug it into watchexec to achieve this. You'd have to run it in the background when working on your project though.
Although this won't be a problem with project SDKs in 4.0, this still needs to be addressed for 3.2.
The callbacks for files being renamed/moved/removed in the Godot file system dock have been there for quite some time. I feel bad because they were added to my request, but I never got to use them to fix this.
Most helpful comment
@akien-mga Of course it's related, it's the same issue :P