-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Moving .cs file in editor clobbers .csproj compile includes #45651
Comments
Update: The default project template seems to have changed a lot between versions 3.2.2 and 3.2.3 and I should note that this requires a project file which has |
Is this still reproducible in 3.4 RC 1 or later? |
The GodotSharpEditor EditorPlugin connects to the The rename method tries to find the godot/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs Lines 59 to 82 in ce11f8f
The method that tries to find the old element is godot/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectExtensions.cs Lines 37 to 59 in ce11f8f
This method iterates over the I'm not sure what would be the proper way to fix this, but have you tried having that <Project Sdk="Godot.NET.Sdk/3.3.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
...
</PropertyGroup>
<ItemGroup>
<Compile Include="new_script.cs"/>
...
</ItemGroup>
<ItemGroup>
<Compile Include="./*.cs" Exclude="script_templates/*.cs">
</ItemGroup>
</Project> Also there is the |
Perhaps a better solution would be for Godot to have its includes handled in its own Edit: For reference, here is a complete copy of my current project file: <Project Sdk="Godot.NET.Sdk/3.2.3">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<!-- <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> -->
</PropertyGroup>
<ItemGroup>
<!-- <Compile Include="**\*.cs" Exclude="script_templates/*.cs" /> -->
<Compile Include="./*.cs" Exclude="script_templates/*.cs" />
<Compile Include="FMCore/**/*.cs" />
</ItemGroup>
</Project> |
I agree, moving the file outside of Godot and editing the .csproj manually seems more convenient. As I explained earlier, the behavior when moving is trying to find a I had an idea, what if on moving we checked if the new path is also covered by the found glob in which case we can assume it does not need to be modified. Although I'm not sure if that may bring other undesired side-effects. |
Fixed by #54262. |
This issue has returned as of 3.4.3 stable. The conditions to get it to occur are to simply create a new C# script file. I normally don't create new scripts from Godot unless I need to use a script template, so I didn't notice the issue before. I've had to set my csproj file to read-only as a temporary workaround. Doing this throws up the following message when creating a new script:
Don't know if that will help pinpoint the regression. |
I have been unable to reproduce it in 3.4.3 stable. The code for Also, the code in that file (ProjectUtils) hasn't really been modified since my PR that fixed this issue 5 months ago so it seems odd that it will break without any changes. This means the issue you are describing could be something that I missed or a new/different issue so my PR didn't fix it. Since I don't seem to be able to reproduce it or maybe I'm misunderstanding the steps to do so, could you describe once again the steps required to reproduce this issue in as much detail as you can? In order to make reproducing the issue easier it'd be great to have a minimal reproduction project that represents the initial state of the project (a simple project with a csproj in its initial state that already contains the compile items with globbing), the csproj in its final state after Godot modifies it (the incorrect result) and the expected csproj (what you expected Godot to do after following the reproduction steps). After following the steps (I assume it'd be something like adding a C# script in a specific folder that is not included by the glob path) I should get the same csproj as the one that was provided for the final state instead of the one provided as the expected csproj. Having said all that, if all you need is to exclude some files have you considered adding them to the <Project Sdk="Godot.NET.Sdk/3.3.0">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<!-- Exclude templates -->
<PropertyGroup>
<DefaultItemExcludes>$(DefaultItemExcludes);script_templates/*.cs</DefaultItemExcludes>
</PropertyGroup>
</Project> |
Sincerest apologies, I'm currently suffering from some connectivity issues that will make it difficult to address things for the next few days. I'm attempting to attach a minimal reproduction project to this comment. I may try modifying my project to implement your suggestions, but solving this issue is still important to me. This project should be set up correctly to replicate the issue. To reproduce it you can do one of two things, and the issues may not be the same but are definitely related. The first is to tried deleting The second way to reproduce the issue is also from the editors icon item list for the file system. Right click and select new script. Select language as c sharp, and use one of the project templates to create another script. This should replace line 8 with a compiler include reference to the script. |
Thank you, I can reproduce the issue with the provided steps. |
@nobuyukinyuu I believe #59521 should fix the issue for the two reproduction steps you mentioned. |
Godot version:
3.2.3 stable.mono.official
OS/device including version:
Windows 10 x64
Issue description:
I have a somewhat lazily customized csproj file which includes all files without having to deal with the "fragility" of Godot's handling of includes. To handle adding new
.cs
files to my project, I've included this line:This usually survives changes and upgrades to the project format, however, I noticed that moving a cs file in the editor disregards this customization. The behavior is that it will remove the above snippet and replace it with one including only the moved file. This obviously breaks a lot of things. Not sure if I'm using an unrecommended way to include files in my project, but it's easier than forcing myself to create every new cs file in godot when I'd rather just be lazy and do it in vscode.
Steps to reproduce:
Minimal reproduction project:
The text was updated successfully, but these errors were encountered: