Forcing namespaces in source files
Hi,
I would like to know if it would be possible to force namespaces for all the source files in a project. And to force just the root namespace defined for the project. Could not find any custom extensions for this so the only way I see it happening as of now is if I write my own custom extension. I also tried it through custom pattern search but it did not work. Getting this through ReSharper settings would work best for me but I'm open to any suggestions.
Thanks for the help.
Please sign in to leave a comment.
Hello!
Thank you for contacting us.
Doesn't the following option ReSharper | Options | Code Editing | C# | Namespace imports | Namespaces that should always be imported provide the expected behavior? With the following code cleanup applied to the project.
Thank you.
Hello Angelina,
The always import setting you mentioned is to force add the 'using' import statement for the namespaces added during the code cleanup , not my requirement. What I'm talking about is a kind of code refactor setting which will add/surround all the code files in a particular project with a fixed namespace which Resharper preferably picks up from the 'RootNamespace' setting of the csharp project. Something like the 'Adjust Namespaces' option already present , but also the ability to force add the namepsace which the 'Adjust Namespace' option does not do. I hope I'm clear about the problem , I can send more details otherwise.