简体   繁体   中英

Fastest way to update namespaces with ReSharper?

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?

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

ReSharper -> Refactor -> Adjust Namespaces...

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).

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM