Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastest way to update namespaces with ReSharper?

Tags:

c#

resharper

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?

like image 260
leora Avatar asked Apr 26 '09 17:04

leora


People also ask

How to change all Namespaces visual studio?

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.

How do you change the namespace of a project in Visual Studio?

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.

How do I refactor namespace in Visual Studio?

Place your cursor in the namespace name. Press Ctrl+. to trigger the Quick Actions and Refactorings menu.


1 Answers

UPDATE: Anyone reading this question with R#5.0 and above should note that this is now a feature:

ReSharper -> Refactor -> Adjust Namespaces...

like image 68
Iain Holder Avatar answered Sep 28 '22 00:09

Iain Holder