0

Possible Duplicate:
What's the best way to do a bulk namespace rename on a large c# application?

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!)

Community
  • 1
  • 1
Bohn
  • 26,091
  • 61
  • 167
  • 254
  • 1
    I think you need to add some language specific tags – Pekka Oct 28 '10 at 18:49
  • 1
    Resharper will refactor in a whole solution. If I change a namespace it changes it in the whole solution not just one project – Mike Two Oct 28 '10 at 18:53
  • @Mike: hmm.. I will try it again...will be awesome – Bohn Oct 28 '10 at 18:54
  • @Mike:Ok, 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. – Bohn Oct 28 '10 at 18:58

3 Answers3

2

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 King
  • 6,233
  • 5
  • 42
  • 63
  • 1
    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. – Richard Marskell - Drackir Oct 29 '10 at 16:09
1

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?

1

R# has an option Adjust Namespaces.

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

Vadim
  • 21,044
  • 18
  • 65
  • 101