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

前端 未结 9 1544
太阳男子
太阳男子 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:36

    It's not the best outcome but can be done without plugins or tools, only with Visual Studio. Find and replace in Entire Solution, Match case, Match whole word. Find what: class name, Replace with: New.Namespace.ClassName (fully qualified class name).

    If you have 100+ references of the moved class and other classes in old namespace what are not moved this is the only foolproof and free solution I found. The only case when it leads to errors is when you have same class name in other namespace.

提交回复
热议问题