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

后端 未结 7 1179
旧时难觅i
旧时难觅i 2020-12-15 15:41

First, a little background.

Currently namespaces and assemblies in our codebase (~60 assemblies, thousands of classes) looks like

WidgetCompany.Depar         


        
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-15 15:49

    Visual Studio 2019 Community Edition supports this as described here. It works for any hierarchy (with dots, root namespace changes etc) and correctly updates all dependencies.

    1. Place your cursor in the class name

    2. Press Ctrl+. to trigger the Quick Actions and Refactorings menu

    3. Select Move to namespace

    4. In the dialog box that opens, select the target namespace you'd like to move the type to

提交回复
热议问题