-
Notifications
You must be signed in to change notification settings - Fork 378
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
C# item templates don't have namespace configuration #6719
Comments
This is not a problem but it is different from Visual Studio's default namespace declaration on created C# filesFolder Structure Of Sample Project:
In this case i am using a namespace in Entity.cs file like following:
Creating that class in Entities folder with Visual Studio uses this namespace too. But creating that class in Entities folder with C# Dev Kit Extension is using a namespace that only contains project base. In my sample project:
And whenever i add a class with C# Dev Kit extension, i am renaming namespace that created with extension. |
Hi @smitpatel, It looks like we have a ticket for tracking this issue: #6010. |
Closing as duplicate. |
Is your feature request related to a problem? Please describe.
The new C# item templates (class, enum etc) doesn't have namespace configuration. It picks up root namespace always at present. This is somewhat unexpected when creating a new class inside a folder as expected namespace would include folder name as sub-namespace.
Describe the solution you'd like.
If templating engine can gather relative path from project file to folder and convert it to namespace to be used for the class that would be most ideal. We already evaluate the project file so computing this should be best experience for user rather than typing long namespace which is error-prone.
If not, then
--namespace
switch on the template like Razor Page template would allow users to specify namespace.Additional context
No response
The text was updated successfully, but these errors were encountered: