Scope of Refactoring in Multi-Project Solutions

There is a subtle connection among the Find References, Rename, and Change Signature commands of Visual Assist, and if you didn’t perceive the connection, you might believe something was awry—with your memory.

The three commands—Find References, Rename, and Change Signature—share a setting to display references from, or refactor in, the current project or all projects. The shared setting prevents you from inadvertently reviewing code with Find References in one scope, then refactoring your code in a broader or narrower scope.

If you restrict Find References to the current project, the default scope of the next Rename or Change Signature is also the current project. If you broaden the scope of Find References to all projects, the default scope of the next Rename or Change Signature is also all projects.

When the scope of Find References is set to all projects, multiple project nodes appear in the results.

blogMultiProjectFindAll

After a Find References whose scope was all projects, the Rename and Change Signature dialogs open with the same scope—all projects.

blogMultiProjectRename

The same holds for reverse use of the commands. If you set the scope in Rename or Change Signature, the next Find References opens with the same scope.

In short, Visual Assist assumes you’re working at the project or solution level, and holds the assumption until you say otherwise.

And remember, you can always fine tune the scope of any Rename or Change Signature by selecting/deselecting references, including entire project nodes, before a commit.

Finally, if you are working in a Universal Solution, there are more nuances to the scope of Find References, Rename, and Change Signature. I’ll touch on those nuances in the next post.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s