Fastest way to update namespaces with ReSharper?

帅比萌擦擦* 提交于 2019-12-18 03:00:10

问题


I have been doing some refactoring and reorganization and I have moved a bunch of files around.

I want to update each file so it has the "correct" namespace according to its new location. With ReSharper, I can go into each file and it shows me that the namespaces is incorrect but that way I have to do it each file at a time.

Is there anyway to update namespaces across every file in a folder or a project?


回答1:


UPDATE: Anyone reading this question with R#5.0 and above should note that this is now a feature:

ReSharper -> Refactor -> Adjust Namespaces...




回答2:


This isn't quite what you want to do ... but hopefully it's helpful.

Go to the class view, and rename the namespace using Ctrl+R,R. It will update that namespace in all the files/folders that it's used in. As long as your namespaces are consistant, it should acheive the same result as changing all the namespaces in a folder.

If your namespaces aren't consistant, and you're just tidying up then I'm afraid you've got a lot of clicking in front of you (or behind you as you've probably already done this).




回答3:


I think that R# doesn't have this function. You can use CTRL-SHIFT-H to find&replace the string.



来源:https://stackoverflow.com/questions/791253/fastest-way-to-update-namespaces-with-resharper

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!