ReSharper User tip #2: Refactor rename namespace

Update! You can now find more user tips with the ReSharper user tip tag.

Have you ever wanted to rename a namespace but you have too many classes in the namespace that it would be an infeasible hassle changing all of them individually. Even using a tool like ReSharper to refactor the namespaces class by class is a hassle. Here is how to rename a namespace for all of its classes in a couple of key strokes using ReSharper.


refactor namespace before

refactor namespace after


  1. Open Class View (Ctrl + Shift + C)
  2. Choose the namespace you want to rename
  3. Press Ctrl + R, R*
    or right-click on the namespace an choose Refactor > Rename
  4. Pick another name
  5. Hit Next

Update! Alternate context menu option to rename namespaces. Tested with ReSharper 5.1.

refactor namespace context menu

and you're done!

Please leave a comment if you found this useful.

* Visual Studio scheme

Comments (15) -

  • anon

    2/9/2014 12:53:15 AM | Reply

    Great! thanks

  • Tony

    2/9/2014 12:53:45 AM | Reply

    To keep from changing your keyboard settings, right click on the namespace and choose Refactor -> Rename

  • Divya

    2/9/2014 12:54:28 AM | Reply

    Thank you!!

  • Dans1

    2/9/2014 12:54:58 AM | Reply

    Did not work for me - Rename is greyed out when the namespace alone is selected, and the shortcut did not work.

    • Rickard

      2/9/2014 12:55:28 AM | Reply

      Thanks for the feedback! I've updated the post with a snap shot, hope it helps. You need to select the name space and not the project.

  • Venu

    2/9/2014 12:56:03 AM | Reply

    was very helpful, thank you.

  • charin

    2/9/2014 12:56:26 AM | Reply

    Thank you!

    • Rickard

      2/9/2014 12:57:21 AM | Reply

      Glad I could help and thanks for your feedback!

      • mimi

        2/9/2014 12:57:52 AM | Reply

        rename worked but i am getting a bunch of errors on initialize() func of UI.

        • Rickard

          2/9/2014 12:58:38 AM | Reply

          Hi mimi, can you please elaborate?

  • shybzzz

    2/9/2014 12:59:39 AM | Reply

    yeah very good
    that's what I need

  • Kenan

    2/9/2014 1:01:36 AM | Reply

    Worked! Thanks

  • bitmonkey

    2/9/2014 1:06:39 AM | Reply

    Perfect! Thank you, Rick.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.