87
votes

I am having trouble finding the right-click context menu in Visual Studio 2015. I know that nothing is wrong with my project or the file I am working. I can find the right-click context refactor menu in Visual Studio 2013. However, in Visual Studio 2015 there isn't a refactor context menu in the right-click context menu.

Where did it go? How do I get it back?

Your suggestion cannot include menu EditRefactor.

I have tried to reset my Visual Studio settings back to default using menu ToolsImport and Export Settings and that didn't bring the menu back either.

5
My point is, the menu-bar refactor menu isn't what is missing.Mr. Young
Any specific times it's not coming up? like method rename or method extract? or just everywhere?Kritner
The problem seems to exist everywhere.Mr. Young
It no longer works when the code won't compile. Previously, you could use it on incomplete code.PRMan

5 Answers

93
votes

Some of the refactoring tools have been relocated or are at least accessible in a different manner than they were previously.

Using the extract method refactor as an example, you can still use this function; it is just not done the same as before:

Select parts to extract

Right click

Right click

Quick actions

Quick actions

Click extract Method

Click extract method

I think they've changed it to feel more "ReSharper"ey. All of the functionality should still be there however.

Here's more information on refactoring in Visual Studio 2015 - hopefully this helps! Refactoring (C#)

2
votes

You no longer need to access the refactoring using the mouse right click.

It is recommended that you use the keyboard shortcut keys within Visual Studio.

For all possible shortcut keys, see Default Keyboard Shortcuts in Visual Studio, Refactor.

2
votes

You might need to build the project to get it to work.

See Code Editing ASP.NET Web Forms in Visual Studio 2013 | Microsoft Docs. (If it is missing then the point is that I am using an example provided by Microsoft.). In Refactoring and Renaming see To extract a method in a C# page. When I follow the instructions I cannot find the feature to extract the code to a method. When I tried the Edit menu it said I did not have valid code. Then I built the project and the feature to extract the code was available and worked.

0
votes

If you change the name of the object you are refactoring, the light bulb then appears to the left which asks if you wish to change the name of the object (i.e. refactor) or generate a new constructor for the new named object.

0
votes

Ctrl + . is the shortcut key for extracting a method in Visual Studio 2015 and onward.

Ctrl+M, R does not work anymore in new versions.