Visual Studio: Is there a “move class to different namespace” refactoring?

前端 未结 9 1486
太阳男子
太阳男子 2020-12-20 12:17

I\'m doing some architectural cleanup that involves moving a bunch of classes into different projects and/or namespaces. Currently I\'m moving the files by hand, building, a

相关标签:
9条回答
  • 2020-12-20 12:45

    Since the answer above was provided (I'm guessing) this feature has been added to CodeRush. Just place the carat on the Type to be moved and you'll see a Move Type to Namespace option on the Refactor! context menu. This will move the type to the new namespace and update references. You may still want to move the file to a solution folder that matches the name of the namespace though.

    0 讨论(0)
  • 2020-12-20 12:47

    As mentioned in the comments, this answer is now outdated. Please see the up-to-date answer below


    Resharper is the only tool I am aware of what has this ability. There is also a lot of other functionality that it has that is missing in CodeRush and Refactor!

    0 讨论(0)
  • 2020-12-20 12:47

    With Resharper: CTRL+R+O

    Then press the down arrow key twice to select Move Type To Another Namespace.

    0 讨论(0)
提交回复
热议问题