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

后端 未结 7 1181
旧时难觅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 16:05

    Right click on your current namespace and select Refactor -> Rename and change the name in the pop up that comes up after a while. Enter your new name and click ok.

    If you have multiple depths to your namespace, then Visual Studio won't let you type a dot. However, if you copy and paste a dot, despite a warning, it will do the business.

    To completely change to the new name, you will likely need to make additional changes manually. You can find where by performing a project search (ctrl+shift+f) for other references to the name in the Project, Solution, or other supporting files from a separate text editor like VS Code. Finally, folders may need to be changed manually as well.

提交回复
热议问题