C# Visual Studio 热键偶尔会更改,特别是用于构建的 F6 与 Ctrl-Shift-B。为什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/854563/
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-08-05 04:19:02  来源:igfitidea点击:

Visual Studio hot keys change occasionally, specifically F6 vs Ctrl-Shift-B for building. WHY?

c#visual-studio-2008

提问by TheSoftwareJedi

I always press F6to build my project. Suddenly some of my Visual Studio instances are wanting me to use Ctrl-Shift-B. It's not keyboard related - the actual text of the menu option changes from "F6" to "Ctrl-Shift-B".

我总是按F6来构建我的项目。突然间,我的一些 Visual Studio 实例想要我使用Ctrl- Shift- B。它与键盘无关 - 菜单选项的实际文本从“ F6”变为“ Ctrl- Shift- B”。

Any answers as to how to fix, and what causes this?

关于如何修复的任何答案,以及是什么原因造成的

采纳答案by CYBERNARESH

This is because you might have selected "General Development Settings" as your default environment settings for your Visual Studio (which usually we do on the first launch of VS after installing it as it pops up a dialogue box to choose default environment settings).

这是因为您可能选择了“通用开发设置”作为 Visual Studio 的默认环境设置(通常我们在安装 VS 后第一次启动时会这样做,因为它会弹出一个对话框来选择默认环境设置)。

If you only want to change the keyboard hotkeys settings, you just follow the solution proposed by others (Tools > Options > Environment > Keyboard > Visual C# 2015). BUTthis will only change the keyboard settings to C# settings while keeping rest of the settings as General settings only.

如果您只想更改键盘热键设置,您只需遵循其他人提出的解决方案(工具 > 选项 > 环境 > 键盘 > Visual C# 2015)。但是这只会将键盘设置更改为 C# 设置,同时将其余设置保留为常规设置。

If you are really intending to change complete environment to C# settings, then follow this approach.

如果您真的打算将完整环境更改为 C# 设置,请遵循此方法。

SOLUTION 1:

解决方案1:

  1. Go to "Tools" (menu)
  2. "Import and Export Settings"
  3. "Import selected environment settings"
  4. Either select "Yes, save my current settings" or "No, just import new settings, overwriting my current settings"
  5. "Which collection of settings do you want to import?"
  6. Under "Default Settings" tree select "Visual C#" node (you might see a yellow warning sign, NO need to worry about it) and then click "Finish" button.
  1. 转到“工具”(菜单)
  2. “导入和导出设置”
  3. “导入选定的环境设置”
  4. 选择“是,保存我当前的设置”或“否,只导入新设置,覆盖我当前的设置”
  5. “您要导入哪个设置集合?”
  6. 在“默认设置”树下选择“Visual C#”节点(您可能会看到黄色警告标志,无需担心),然后单击“完成”按钮。

or you can do the same like

或者你也可以这样做

SOLUTION 2:

解决方案2:

  1. Go to "Tools" (menu)
  2. "Import and Export Settings"
  3. "Reset all settings"
  4. Either select "Yes, save my current settings" or "No, just import new settings, overwriting my current settings"
  5. Select "Visual C#" from the list and then click "Finish" button.
  1. 转到“工具”(菜单)
  2. “导入和导出设置”
  3. “重置所有设置”
  4. 选择“是,保存我当前的设置”或“否,只导入新设置,覆盖我当前的设置”
  5. 从列表中选择“Visual C#”,然后单击“完成”按钮。

Both approaches would give you the same result of changing your complete environment to 'Visual C#" there onward.

这两种方法都会为您提供相同的结果,将您的完整环境更改为“Visual C#”。

Enjoy Coding :)

享受编码:)

回答by stuartd

Your keyboard scheme has changed - go to Tools/Options/Environment/Keyboard and set the default keyboard scheme to 'Visual C# 2005'

您的键盘方案已更改 - 转到工具/选项/环境/键盘并将默认键盘方案设置为“Visual C# 2005”

回答by ScottCher

Keyboard mapping corruption issue perhaps? Check Tools / Options, Environment / Keyboard. Should see a drop-down for your Keyboard mapping scheme and next to it a Reset button. Hit the reset button.

可能是键盘映射损坏问题?检查工具/选项、环境/键盘。应该会看到键盘映射方案的下拉菜单,旁边是重置按钮。按下重置按钮。

I'm not responsible for this screwing with your settings - save them prior to doing this just in case you screw the pooch.

我不负责你的设置 - 在执行此操作之前保存它们,以防万一你搞砸了狗。

Oh, in case the narcs out there care, I think this is a valid question and would be put out if someone voted to close it. Of course now that I've said that, its a certaintity, isn't it?

哦,万一那里的 narcs 关心,我认为这是一个有效的问题,如果有人投票关闭它就会被淘汰。当然,既然我这么说了,那是肯定的,不是吗?

回答by Nick Whaley

Its because you installed VMWare. It remaps that key so that F6 can be used to start debugging on a virtual machine.

因为你安装了VMWare。它重新映射该键,以便 F6 可用于在虚拟机上启动调试。

Annoyed me too.

也烦死我了。

回答by Chris Harden

If you have other key bindings and dont want to reset the lot use: Tools -> Options -> Environment -> Keyboard

如果您有其他键绑定并且不想重置批次,请使用: Tools -> Options -> Environment -> Keyboard

Then find Build.BuildSolutionor Build.RebuildSolution(on your preference) select Globalin the Use shortcut indropdown, place the cursor in Press Shortcut Keyand slap F6. It'll show you what it is currently assigned to, for me is was to traverse split panes (maybe it overrides F6when you use split panes for the first time? I've always wondered why my home development machine built with F6and my work one doesn't and come to think of it I've never used split panes at home) then hit Assign.

然后在下拉列表中找到Build.BuildSolutionBuild.RebuildSolution(根据您的喜好)选择,将光标放入并拍打。它会告诉你它当前分配给什么,对我来说是遍历分割窗格(也许当你第一次使用分割窗格时它会覆盖?我一直想知道为什么我的家庭开发机器和我的工作机器一起构建没有并且想到它我从未在家中使用过拆分窗格)然后点击分配。GlobalUse shortcut inPress Shortcut KeyF6F6F6

回答by CAD bloke

Notepad++'s NPPscripting plugin broke Ctrl-Shift-B for my whole OS while NP++ was running. Uninstalling the plugin (I had to delete the DLL manually from the Notepad++ plugins folder) fixed the broken key mapping for me.

Notepad++ 的 NPPscripting 插件在 NP++ 运行时破坏了我整个操作系统的 Ctrl-Shift-B。卸载插件(我必须从 Notepad++ 插件文件夹中手动删除 DLL)为我修复了损坏的键映射。

回答by domenu

You can reassign SHIFT+ F6to build the current project only:

您可以重新分配SHIFT+F6以仅构建当前项目:

1/ Go to Tools -> Options -> Environment -> Keyboard

1/ 前往 Tools -> Options -> Environment -> Keyboard

2/ Show commands containing: Build.BuildSelection

2/ 显示命令包含: Build.BuildSelection

3/ Focus the field Press shortcut keys& press Shift+ F6to assign it

3/ 聚焦该字段Press shortcut keys并按Shift+ 对其F6进行分配

回答by 0xBADF00D

I had TPFanControl installed which captured Ctrl+Shift+Bglobally. I used a tool mentioned in this answereto find out which program registered for which shortcuts.

我有TPFanControl安装的捕捉Ctrl+ Shift+B全球。我使用了这个答案中提到的工具来找出哪个程序注册了哪些快捷方式。

回答by Elaskanator

I had a stale build in my solution (included libraries were apparently using old DLL versions and I was getting MissingMethodException's at runtime) so I deleted all the \bin directories in my C# projects, restarted Visual Studio, and suddenly this issue is now affecting me for the first time in the 3+ years since I started using Visual Studio.

我的解决方案中有一个陈旧的构建(包含的库显然使用旧的 DLL 版本,我在运行时遇到了 MissingMethodException),所以我删除了 C# 项目中的所有 \bin 目录,重新启动了 Visual Studio,突然这个问题现在影响了我自从我开始使用 Visual Studio 以来,这是 3 年多以来的第一次。

No clue how this could have affected my user settings, but it apparently did. They went from using the "Visual C# 2005" keyboard profile to "default"

不知道这会如何影响我的用户设置,但显然确实如此。他们从使用“Visual C# 2005”键盘配置文件变为“默认”

回答by user3419724

Tools -> Options -> Environment -> Keyboard

工具 -> 选项 -> 环境 -> 键盘

search this command: "ClassViewContextMenus.ClassViewProjectBuild"

搜索此命令:“ClassViewContextMenus.ClassViewProjectBuild”

Assign F6

分配 F6