Bulk Fixes and Refactorings in ReSharper 9

One of the key aspects of ReSharper’s operations is the ability to perform changes in bulk — for example, a bulk option to remove unused using directives can affect hundreds of files, while preserving the overall integrity of the solution. In ReSharper 9, we have improved upon this functionality with even more support for global changes that can be made instantaneously.

Bulk Import

When you import a chunk of code, ReSharper is now able to look through the code in your solution and generate the appropriate imports for all the types:


It is, of course, possible to choose between importing a single chosen type rather than all possible types:

It’s worth noting that, in addition to ordinary member methods, extension methods get imported as well. The only case when R# is unable to import a type is when it resolves to two different namespaces (e.g., System.String and User.String).

Removing Redundant Code

ReSharper has already had fixes for removing redundant unused directives globally, but now we’ve expanded this idea to remove all redundant code across the solution. Furthermore, there are two options here. First, you can apply any one particular inspection across a variety of scopes:


Alternatively, you can remove all redundant code in one fell swoop:


Global Naming Fixes

If you import someone else’s code, it’s likely they are not using the same naming convention that you are. Previously, you would have had to go through each of the elements and apply a fix for every one of them. In ReSharper 9, you can apply the changes en masse:

Invoking a fix brings up a dialog showing what will be renamed and where:

Move to Namespace/File

We’ve made an improvement to the Move to Namespace and Move to File actions, ensuring that, if a single file has multiple class declarations, all of those declarations get moved:

Death to Regions

Not all of us like regions. Some of us positively do not. So when you import someone else’s code and that someone is particularly zealous about using regions, you can now undo that travesty globally with one command:


This blog post has outlined a number of the most visible types of bulk fixes in ReSharper – there are certainly a lot more, including those related to JavaScript and TypeScript. We hope you enjoy these bulk fixes in ReSharper 9!

Get ReSharper

image description