I have been doing some refactoring and reorganization and I have moved a bunch of files around.
I want to update each file so it has the "correct" namespace according to its new location. With ReSharper, I can go into each file and it shows me that the namespaces is incorrect but that way I have to do it each file at a time.
Is there anyway to update namespaces across every file in a folder or a project?
You could put the caret on a namespace declaration in your C# code and press F2 on the keyboard. This should let you change the name of the namespace across the entire project, including the XAML files. At least this works for me in Visual Studio 2015. Hope that helps.
You can change the default namespace: -> Project -> XXX Properties... Instead of Find/Replace, you can also right click the namespace in code and Refactor->Rename.
Place your cursor in the namespace name. Press Ctrl+. to trigger the Quick Actions and Refactorings menu.
UPDATE: Anyone reading this question with R#5.0 and above should note that this is now a feature:
ReSharper -> Refactor -> Adjust Namespaces...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With