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 (13) -

  • anon

    2014-02-09 00:53:15 | Reply

    Great! thanks

  • Tony

    2014-02-09 00:53:45 | Reply

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

  • Divya

    2014-02-09 00:54:28 | Reply

    Thank you!!

  • Dans1

    2014-02-09 00:54:58 | Reply

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

    • Rickard

      2014-02-09 00:55:28 | 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

    2014-02-09 00:56:03 | Reply

    was very helpful, thank you.

  • charin

    2014-02-09 00:56:26 | Reply

    Thank you!

    • Rickard

      2014-02-09 00:57:21 | Reply

      Glad I could help and thanks for your feedback!

      • mimi

        2014-02-09 00:57:52 | Reply

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

        • Rickard

          2014-02-09 00:58:38 | Reply

          Hi mimi, can you please elaborate?

  • shybzzz

    2014-02-09 00:59:39 | Reply

    yeah very good
    that's what I need

  • Kenan

    2014-02-09 01:01:36 | Reply

    Worked! Thanks

  • bitmonkey

    2014-02-09 01:06:39 | 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.