Skip to content
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 .csproj configuration to nest the new .uid files #11888

Open
JoNax97 opened this issue Mar 2, 2025 · 2 comments
Open

Add .csproj configuration to nest the new .uid files #11888

JoNax97 opened this issue Mar 2, 2025 · 2 comments

Comments

@JoNax97
Copy link

JoNax97 commented Mar 2, 2025

Describe the project you are working on

A game using C# and Rider

Describe the problem or limitation you are having in your project

With the introduction of the new .uid files, every .cs and .gd file now has a dependent file that must be moved, deleted, etc alongside it. This is handled well enough inside Godot, but projects using C# will often use an external IDE like Rider or Visual Studio for moving files around and now need to manually bookkeep the uid files.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

For .net projects, the .csproj format allows for defining dependent files, and major IDEs use this for showing files as nested, as well as bringing them along on copy/move/delete operations.

We can leverage this by including a new section in the auto-generated .csproj file, that will make all .uid and .import files dependent on their main file.

For example, it makes files in Rider look like this:

Image

When moving a file, it will move the uid file as well:

Image

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

<Project>

    <ItemGroup>
        <!-- Ensure .uid and .import files are visible in the solution --> 
        <!-- <None> is used for non-compilable, non-copyable files that are not part of the build output --> 
        <None Include="**/*.import" />
        <None Include="**/*.uid" />

        <!-- This is just an example, all files that we want visible should be included like this. -->
        <!-- For an official versio, I think all godot-native file extensions as well as all extensions recognized by an importer. -->
        <None Include="**/*.tscn" />
        <None Include="**/*.png" />
        
        <!-- Set nesting behavior -->
        <None Update="**/*.import">
            <DependentUpon>$([System.Text.RegularExpressions.Regex]::Replace('%(Filename)%(Extension)', '\.import$', ''))</DependentUpon>
        </None>
        <None Update="**/*.uid">
            <DependentUpon>$([System.Text.RegularExpressions.Regex]::Replace('%(Filename)%(Extension)', '\.uid$', ''))</DependentUpon>
        </None>
    </ItemGroup>
</Project>

If this enhancement will not be used often, can it be worked around with a few lines of script?

It can be done, but it's kind of an advanced feature that not many users would be aware of.

Is there a reason why this should be core and not an add-on in the asset library?

I could be distributed via NuGet, but again the main problem is discoverability.

@JoNax97
Copy link
Author

JoNax97 commented Mar 2, 2025

Note that in the future, I expect Rider to add more tailored support for Godot files, like it does with Unity's meta files. But this should still give users a good baseline that should work across major .NET tools.

@van800
Copy link

van800 commented Mar 2, 2025

I am in charge of Rider plugin for Godot. Rider 25.1 eap already has improvement for uid.
JetBrains/godot-support@9c4e21d
However I didn't know about import files.

I was experimenting with a bit simpler include

<ItemGroup>  <None Include="*.cs.uid"> <DependentUpon>%(Filename).cs</DependentUpon> </None></ItemGroup>

However it is just for cs files, while yours is for all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants