Resharper-unity: .asmdef / root namespace

Created on 23 Mar 2020  路  8Comments  路  Source: JetBrains/resharper-unity

Hello,

It would be great if there was a way to specify the root namespace for rider/unity projects.
I raised this in the unity forum and got redirected to this issue tracker.
Post: https://forum.unity.com/threads/rider-asmdef-namespace.852121/#post-5619076

I think a great way to solve this would be to be able to specify it inside the .asmdef file.
There us already a way to specify a package name, but using this would restrict the root namespace to the package name, not sure if this would be desired or not.

Having an additional field might require coordination with unity team.

I am unsure if VisualStudio has similiar issues or how it is handled, since .csproj files are generated on the fly it is not really possible to provide this info to the package.

Here is my .asmdef for a local package
Capture

Here is the warning about my namespace:
Capture

Maybe there are other ways to solve this, would be happy if there is a solution or maybe I am missing something that it is already possible and I am doing something wrong.

Thank you

Most helpful comment

As a workaround you may switch from UnityExplorer to SolutionExplorer. Right click on packages folder would allow to uncheck Namespace Provider for it.
image

All 8 comments

A workaround to the issue with namespaces in the Packages/ folder could be handled the same way as with namespaces in the Assets folder, strip away "Packages/" when suggesting namespace. This is not the best solution, and I would like to handle namespaces within assembly-definitions, but it helps with avoiding the basic namespace clutter.

image

As a workaround you may switch from UnityExplorer to SolutionExplorer. Right click on packages folder would allow to uncheck Namespace Provider for it.
image

See also RIDER-36546

Hey @citizenmatt,
Now that Unity 2020.2 added support for rootNamespace in .Asmdef, is there a plan to support it in Rider?

Rider package 2.0.6 would have it, when combined with Unity 2020.2. @Nirlah

And #1677 and #1689 both handle the case where an assembly definition has a root namespace. Folders in the assembly definition project are used as namespace segments against the root namespace.

I'm going to close this now, as it's really a Unity feature that is solved with Unity 2020.2 and supported by Rider 2020.2.

@van800 I love you, man. You just made my life easier

Was this page helpful?
0 / 5 - 0 ratings

Related issues

persn picture persn  路  3Comments

RealMSHB picture RealMSHB  路  3Comments

real-mikhail picture real-mikhail  路  5Comments

justinlueders picture justinlueders  路  5Comments

SugoiDev picture SugoiDev  路  6Comments