views:

29

answers:

3

I am changing the Default Namespace for my projects in the solution. I can use Resharper for example to adjust the namespaces for me in ONE project. but I am looking for some tool that can adjust the namespaces in the whole SOLUTION. I am using VS2008 pro. is there a refacotring tool that can adjust the namespaces in the all projects of my solution? ( it is about 60 projects in the solution! pain!)

+1  A: 

Find and Replace?
How many projects are there? Can't you just do each project. It's not like you'll have to do it more than once, right?

Drackir
yeah! but it means for each of these 60 project, run "find replace" for 59 times!
BDotA
Find and Replace can work across the whole solution. Change "Look In" to "Entire Solution".
Drackir
+1  A: 

R# has an option Adjust Namespaces.

Right click on the solution. Then choose Refactor from the context menu and click on "Adjust Namespaces..."

Vadim
yes I did. No dialog pops up when I run it on the solution, but the adjsut namespace pops up when I do it on each project.
BDotA
You're right it works for projects and folders inside a project but not for solutions. At least you don't have to do for each file independently.
Vadim
@Vadim: The OP already mentioned that they could do this.
Drackir
+2  A: 

Refactor a namespace DOES work in Resharper... right-click on the namespace you want to rename, pick refactor->refactor this, then pick rename namespace in the mini-popup in the editor. I.E namespace myproj.data { - right-click on 'data'

Pick a new name, click 'next', and Resharper will rename the namespace throughout the application.

You can also right-click and just pick refactor->rename... I've tested both, they both work.

James B
This is actually a built in feature in Visual Studio and it does appear to rename across all projects that utilize the same namespace. You Can preview the changes to files before they're made as well.
Drackir