VisualStudio2015中缺少重构菜单

我在 VisualStudio2015中找不到右击上下文菜单。我知道我的项目或我正在处理的文件没有任何问题。我可以在 VisualStudio2013中找到右击上下文重构菜单。但是,在 VisualStudio2015中,右击上下文菜单中没有重构上下文菜单。

它去哪了? 我怎么拿回来?

您的建议不能包括菜单 剪辑重构

我尝试重置我的 Visual Studio 设置回默认使用菜单 工具导入和导出设置,这也没有带回菜单。

48650 次浏览

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

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.

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.

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.

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.