visual-studio 如何在 Visual Studio 中禁用 ReSharper 并再次启用它?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2189792/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:30:39  来源:igfitidea点击:

How can I disable ReSharper in Visual Studio and enable it again?

visual-studiovisual-studio-2008resharper

提问by ali62b

I installed ReSharper, and it works in Visual Studio, but how can disable it?

我安装了ReSharper,它在 Visual Studio 中工作,但如何禁用它?

Whenever I search in the ReSharper menu I can't find a disable option.

每当我在 ReSharper 菜单中搜索时,我都找不到禁用选项。

回答by Matthew Perron

You can disable ReSharper 5 and newer versions by using the Suspendbutton in menu Tools-> Options-> ReSharper.

您可以使用菜单Tools-> Options-> ReSharper 中Suspend按钮禁用 ReSharper 5 和更新版本。

enter image description here

在此处输入图片说明

回答by Oscar Mederos

If you want to do it without clicking too much, open the Command Window (Ctrl+ W, A) and type:

如果您不想点击太多,请打开命令行窗口(Ctrl+ W, A)并键入:

ReSharper_Suspendor ReSharper_Resumedepending on what you want.

ReSharper_SuspendReSharper_Resume取决于你想要什么。

Or you can even set a keyboard shortcut for this purpose. In Visual Studio, go to Tools-> Options-> Environment-> Keyboard.

或者您甚至可以为此设置键盘快捷键。在 Visual Studio 中,转到Tools-> Options-> Environment-> Keyboard

There you can assign a keyboard shortcut to ReSharper_Suspendand ReSharper_Resume.

在那里,您可以为ReSharper_Suspend和分配键盘快捷键ReSharper_Resume

The Command Window can also be opened with Ctrl+ Alt+ A, just in case you're in the editor.

在命令窗口中还可以与开Ctrl+ Alt+ A,万一你在编辑器中是。

Enter image description here

在此处输入图片说明

回答by Kevin Driedger

Bind ReSharper_ToggleSuspendedto a shortcut key.

绑定ReSharper_ToggleSuspended到快捷键。

Steps:

脚步:

  1. Tools>Options
  2. Click Keyboard on the left hand side
  3. Type "suspend" in the "Show commands containing:" input box
  4. Pick the "ReSharper_ToggleSuspended"
  5. Press shortcut keys: and
  6. Press the "Assign" button.
  1. 工具>选项
  2. 单击左侧的键盘
  3. 在“显示命令包含:”输入框中输入“暂停”
  4. 选择“ReSharper_ToggleSuspended”
  5. 按快捷键:和
  6. 按“分配”按钮。

Binding ReSharper_ToggleSuspendedto a shortcut key (in my case: Ctrl-Shift-Q) works very well. With ReSharper not supporting the async CTP yet (as of mid-2011), when dipping into the code the uses the async keyword, this shortcut is invaluable.

绑定ReSharper_ToggleSuspended到快捷键(在我的情况下:Ctrl-Shift-Q)效果很好。由于 ReSharper 尚不支持异步 CTP(截至 2011 年年中),在深入研究使用 async 关键字的代码时,此快捷方式非常宝贵。

回答by Derek Ziemba

I always forget how to do this and this is the top result on Google. IMO, none of the answers here are satisfactory.

我总是忘记如何做到这一点,这是 Google 上的最佳结果。IMO,这里的答案都不令人满意。

So this time, for the next time I search this and to help others, here's how to do it and what the button looks like to toggle it:

所以这一次,下次我搜索这个并帮助其他人时,这里是如何做到这一点以及切换它的按钮是什么样的:

Toggle Resharper Toolbar Button

切换 Resharper 工具栏按钮

Open package manager consolevia the Quick Launchbar near the caption buttons to launch a PowerShell instance. Enter the code below into the Package Manager Console Powershell instance:

package manager console通过Quick Launch标题按钮附近的栏打开以启动 PowerShell 实例。在包管理器控制台 Powershell 实例中输入以下代码:

If you want to add it to the standard toolbar:

如果要将其添加到标准工具栏:

$cmdBar = $dte.CommandBars.Item("Standard") 
$cmd = $dte.Commands.Item("ReSharper_ToggleSuspended")
$ctrl = $cmd.AddControl($cmdBar, $cmdBar.Controls.Count+1)
$ctrl.Caption = "R#"

If you want to add it to a new custom toolbar:

如果要将其添加到新的自定义工具栏:

$toolbarType = [EnvDTE.vsCommandBarType]::vsCommandBarTypeToolbar
$cmdBar = $dte.Commands.AddCommandBar("Resharper", $toolbarType)
$cmd = $dte.Commands.Item("ReSharper_ToggleSuspended")
$ctrl = $cmd.AddControl($cmdBar, $cmdBar.Controls.Count+1)
$ctrl.Caption = "R#"

If you mess up or weren't happy with the bar you added it to and need to start over, remove it with:

如果您搞砸了或对添加的栏不满意并需要重新开始,请使用以下命令将其删除:

$ctrl.Delete($cmdBar)
$dte.Commands.RemoveCommandBar($cmdBar)

In addition to adding the button, the keyboard shortcut ctrl+shift+Num -, ctrl+shift+Num -(that is: ctrl shift and double-tap keypad_minus) works great.

除了添加按钮之外,键盘快捷键ctrl+shift+Num -, ctrl+shift+Num -(即:ctrl shift 和双击 keypad_minus)也很好用。

EDIT: Looks like StingyHyman found the original post I found long ago, that never shows up when I do a google search for this: https://stackoverflow.com/a/41792417/16391

编辑:看起来 StingyHyman 找到了我很久以前找到的原始帖子,当我用谷歌搜索这个时,它从未出现过:https: //stackoverflow.com/a/41792417/16391

回答by rufer7

If resharper is completely missing from the options menu, it could be because the extension itself has been disabled.

如果选项菜单中完全没有 resharper,可能是因为扩展本身已被禁用。

In Visual Studio 2017 ReSharper 2018.X.X can be enabled and disabled by going to Help> Manage Visual Studio Performance. Then select JetBrains ReSharper ...under Extensions.

在Visual Studio 2017年ReSharper的2018.XX可以启用并要禁用Help> Manage Visual Studio Performance。然后JetBrains ReSharper ...在 下选择Extensions

enter image description here

在此处输入图片说明

In Visual Studio 2019, you would go under Extensions->Manage Extensions->Installed

在 Visual Studio 2019 中,您将进入 Extensions->Manage Extensions->Installed

回答by T.J. Crowder

You can add a menu item to toggle ReSharper if you don't want to use the command window or a shortcut key. Sadly the ReSharper_ToggleSuspendedcommand can't be directly added to a menu (there's an open issue on that), but it's easy enough to work around:

如果您不想使用命令窗口或快捷键,您可以添加一个菜单项来切换 ReSharper。遗憾的是,该ReSharper_ToggleSuspended命令不能直接添加到菜单中(有一个未解决的问题),但很容易解决:

Create a macro like this:

创建一个这样的宏:

Sub ToggleResharper()

    DTE.ExecuteCommand("ReSharper_ToggleSuspended")

End Sub

Then add a menu item to run that macro:

然后添加一个菜单项来运行该宏:

  1. Tools | Customize...
  2. Choose the Commands tab
  3. Choose the menu you want to put the item on
  4. Click Add Command...
  5. In the list on the left, choose "Macros"
  6. In the resulting list on the right, choose the macro
  7. Click OK
  8. Highlight your new command in the list and click Modify Selection... to set the menu item text etc.
  1. 工具 | 定制...
  2. 选择命令选项卡
  3. 选择要放置项目的菜单
  4. 单击添加命令...
  5. 在左侧列表中,选择“宏”
  6. 在右侧的结果列表中,选择宏
  7. 单击确定
  8. 在列表中突出显示您的新命令,然后单击修改选择...以设置菜单项文本等。

回答by VivekN

You need to goto Tools-->Options--->Select Resharper--->Click on suspend now,to disable it

你需要去工具-->选项--->选择Resharper--->点击暂停,禁用它

回答by vezenkov

In ReSharper 8: Tools -> Options -> ReSharper -> Suspend Now

在 ReSharper 8 中:工具 -> 选项 -> ReSharper -> 立即暂停

回答by Waqas ali

For ReSpharper 2017.2.2 goto ->ReSpharper->options-> Product and features. enter image description here

对于 ReSharper 2017.2.2 转到 ->ReSharper->options-> Product and features。 在此处输入图片说明

回答by san

Tools -> Options -> ReSharper (Tick "Show All setting" if ReSharper option not available ). Then you can do Suspend or Resume. Hope it helps (I tested only in VS2005)

工具 -> 选项 -> ReSharper(如果 ReSharper 选项不可用,请勾选“显示所有设置”)。然后你可以做暂停或恢复。希望有帮助(我只在 VS2005 中测试过)