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

Assembly definition root namespace behaviour #2427

Open
dngulin opened this issue Nov 1, 2023 · 2 comments
Open

Assembly definition root namespace behaviour #2427

dngulin opened this issue Nov 1, 2023 · 2 comments

Comments

@dngulin
Copy link

dngulin commented Nov 1, 2023

Setting the asmdef root namespace doesn't exclude parent directories from namespace providers. So, it just sets a new namespace prefix.

As I remember, it should replace all parent directories. At least that behaviour is described in the source code comment and I believe it used to work this way.

My environment:

  • Unity 2023.1.19f1
  • Unity package com.unity.ide.rider 3.0.26
  • JetBrains Rider 2023.2.2 (#RD-232.9921.83)
@citizenmatt
Copy link
Member

Could you provide an example, please? This should generate a .csproj file that contains a root namespace, and that namespace should be used as the root namespace for all files - any folder under the project location will be suggested as a sub-namespace of this custom root namespace.

@dngulin
Copy link
Author

dngulin commented Nov 11, 2023

The root namespace in the csproj file is the same as in the assembly definition. The problem is that asmdef parent directories work as namespace providers for the project files.

For example, I have two files:

Assets/Modules/Level/Code/Level.asmdef
Assets/Modules/Level/Code/Core/SampleType.cs

The asmdef has the rootNamespace: "Level". In that case for the SampleType I expect to have the Level.Core namespace, but Rider suggest the Level.Modules.Level.Code.Core.

As a workaround I manually disable the namespace provider property for all parent directories, but I believe it used to work without setting them.

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

No branches or pull requests

2 participants